ViewPager and OnItemClickListener in ListView

I am working on creating a scroll list view adapter. My main methodology is to wrap the view of the list item as a second view in the ViewPager and provide the necessary callbacks in the change listener of the ViewPager items. Due to the great pain, I have a working View examiner, as expected, as well as the ViewHolder and ViewBinder templates. I even managed to keep the ListView from capturing touch events while scrolling through the ViewPager without having to create a custom subclass of ListView (I can do all this from the adapter).

When I OnItemClickListener into difficulties, you will get a selector and OnItemClickListener . Looking at the source of the ListView, it seemed that by overriding the ViewFager hasFocusable () method to always return false (later I pulled this value from the child view), these things should have been re-enabled. Unfortunately, this is not the case. I tried the setDecendantFocusability() workaround and I am still stuck.

I would like to avoid the ListView extension, if possible, provide the maximum degree of modularity. For similar reasons, I do not want to add a selector to the background of the ViewPager (if dev changes the ListView selector, this will not be reflected). Essentially, I'm looking to make the ViewPager code transparent between a ListView and a child view. Any ideas?

+7
android android-viewpager listadapter
source share
1 answer

Are you saying that you make each list item a pager of the kind so that you can implement cleanup for deletion? If so ... no, this is not what a pager is for. Sorry at first, it's just not intended to be used as an item in a list. Secondly, to switch between views, and not to delete.

Unfortunately, we do not have a sample code to show how to do this, but you can look at the implementation of the notification panel platform or the latest applications to get some ideas.

+7
source share

All Articles