Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old 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
Default 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?
Attached Files
File Type: zip DemoUnscrollableAdapter.zip (23.2 KB, 1 views)

QuickNick is offline  
Reply With Quote
Sponsors
Old December 9th, 2011, 03:24 AM   #2 (permalink)
Junior Member
 
Join Date: Jun 2011
Posts: 32
 
Device(s):
Thanks: 8
Thanked 2 Times in 2 Posts
Default

I've solved the problem. By mistake I set property of inflatable view as "clickable" in layout. Therefore, it consumes clicks and any its parent in view hierarchy doesn't receive these events. Very stupid mistake
QuickNick is offline  
Reply With Quote
Reply

Bookmarks

Tags
custom adapter, custom view, onclicklistenter, touch event


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 11:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo