Android ListViews not clickable

20 Nov

Apparently ListViews lose their clickability if they contain focusable child elements in their layout.

I initially set all the child elements to not be focusable.

But now do this in the getView() method instead:

((ViewGroup) convertedView).setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
Advertisements

3 Responses to “Android ListViews not clickable”

  1. Babar May 12, 2012 at 8:47 am #

    hi i use the above code in my getView() but exception comes….
    im my custom list view rows there is a focusable child i.e checkbox so please help me

  2. Babar May 12, 2012 at 8:53 am #

    thanx alot i have solved a big problem just because of you i have been searching for this kind of thing for few days…actually a have a custom listview with four text views and a checkbox…initially listview was not clickable…but now in my layout i simply set checkbox focusbility false now i can click my list view….
    Regards
    babar

  3. Jagdish kumawat May 29, 2012 at 9:48 am #

    Thanx a lot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: