I've figured it out. What I did was to call setTag() with a name to all Views/ListViews, and just call findViewWithTag(mytag), mytag being the tag.
Unfortunately, there's no other way to solve this.
回答2:
You can get the current element by accessing your list of itens from your adapter calling myAdapter.yourListItens.get(myViewPager.getCurrentItem()); As you can see, ViewPager can retrieve the current index of element of you adapter (current page).
If you is using FragmentPagerAdapter you can do this cast:
During my endeavors to find a way to decorate android views I think I defined alternative solution for th OP's problem that I have documented in my blog. I am linking to it as the code seems to be a little bit too much for including everything here.
The solution I propose:
keeps the adapter and the view entirely separated
one can easily query for a view with any index form the view pager and he will be returned either null if this view is currently not loaded or the corresponding view.
回答6:
Use an Adapter extending PagerAdapter, and override setPrimaryItem method inside your PagerAdapter.