문제

In my android application, I layout the main activity using ViewPager with Action Bar. The PagerAdapter is FragmentStatePagerAdapter.

My first fragment contains a ListView with batch contextual actions enabled. When CAB is on the screen, I swipe to the next fragment, it is still on. Actually, it is kept in all fragments. How can I remove it when swiping?

There may be other states keeping when swiping. How can remove them all?

도움이 되었습니까?

해결책

  1. Make your activity implement ViewPager.OnPageChangeListener
  2. Set the OnPageChangeListener of your ViewPager to be the activity
  3. In your overridden onPageSelected(int position) method, dissmiss your CAB
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top