Get focused View from ViewPager

后端 未结 11 1366
情深已故
情深已故 2020-11-27 12:50

i use the ViewPager for switching views with left/right swipe.

The ViewPager needs an Adapter, so I\'ve built this one:

public class ListViewPagerAda         


        
11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 13:38

    If you examine carefully, there are at most 3 views saved by ViewPager. You can easily get the current view by

    view     = MyActivity.mViewPager.getChildAt(1);
    

提交回复
热议问题