How to determine when Fragment becomes visible in ViewPager

后端 未结 26 1328
心在旅途
心在旅途 2020-11-22 00:24

Problem: Fragment onResume() in ViewPager is fired before the fragment becomes actually visible.

For example, I have 2 fragments with

26条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 01:01

    Add following Code inside fragment

    @Override
    public void setMenuVisibility(final boolean visible) 
     {
        super.setMenuVisibility(visible);
        if (visible && isResumed()) 
         {
    
         }
    }
    

提交回复
热议问题