December 8th, 2011, 08:39 AM
|
#1 (permalink)
|
|
Junior Member
Join Date: Jun 2011
Posts: 32
Device(s):
Thanks: 8
Thanked 2 Times in 2 Posts
|
OnClick doesn't fired
Good day. I'm trying to make unscrollable listview (I need to enterprise dynamic values by the list, but this list must be in ScrollView).
I've tried to imitate construction of ListView and ListAdapter. You can see the source in the attached zip file.
My "FilterGroupView" is made this way: we set some BaseFilterGroupAdapter, then view starts to redraw itself. It gets header from adapter and then it gets item views (item views are added into special mItemsContainer).
When item views are being added, we attach OnClickListeners to them. In this case, it is private inner class FilterGroupView.ItemsOnClicksListener.
I wonder that instances of this class are created but event "onClick" sometimes doesn't fired.
I've experimented with different views in SimpleFilterGroupAdapter. In its method "getView" you can see cases.
1)Create custom view as inner class in adapter. Custom view inflate my layout (simple_filter_group_child_item) in constructor. onClick isn't fired.
2)Inflate layout right in the method and returns result view. onClick is fired.
3)Create custom view outside of adapter, it inflate layout. onClick isn't fired.
4)Create custom view in layout (simple_filter_group_item_compiled). In adapter we call LayoutInflater.inflate(R.layout.simple_filter_grou p_item_compiled, null). onClick isn't fired.
5)Create a wrapper of custom outside view. onClick isn't fired.
6)Create a wrapper of custom inner view. onClick isn't fired.
7)Create custom inner view-2: it inflates android.R.layout.simple_list_item_1. onClick is fired.
Please, explain: why my custom views "eat" click events? What flag did I forget to add?
|
|
|