Get focused View from ViewPager

后端 未结 11 1310
情深已故
情深已故 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条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 13:40

    You can add a tag to the created view in the instantiateItem method:

    view.setTag(position);
    

    Later you can access the current selected view by:

    mPager.findViewWithTag(mPager.getCurrentItem());
    

提交回复
热议问题