How to know if a Fragment is Visible?

前端 未结 10 1954
闹比i
闹比i 2020-12-01 06:07

I\'m using the support library v4 and my questions are, How to know if a Fragment is Visible? and How can I change the propierties of the Layout inflated in the Fragment? Th

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 06:32

    You can override setMenuVisibility like this:

    @Override
    public void setMenuVisibility(final boolean visible) {
       if (visible) {
          //Do your stuff here
       }
    
       super.setMenuVisibility(visible);
    }
    

提交回复
热议问题