ListView doesn’t respond to OnItemClickListener

10 Feb

There will be case that your custom list item doesn’t respond when you click…so what’s the reason and what’s the solution?

Here several problems and solutions:

1. Scenario: list item layout contains CheckBox

Problem: OnItemClickListener doesn’t respond.

Reason: CheckBox is also having its own click listener by default to change its state, and it overrides the container ListView.

Solution: remove focus on CheckBox by setting these attributes to “false”


1 android:focusable="false"
2 android:focusableInTouchMode="false"


2. Scenario: random

ProblemOnItemClickListener just doesn’t repond any at all!!!!

Reason: No idea..

Solution: in code, just set OnItemClickListener before setting Adapter. It works randomly @@!

3. Scenario: list item contains ImageButton

ProblemOnItemClickListener just doesn’t repond any at all!!!!

Reason: No idea!!!

Solution: in code, set ImageButton focus to “false”


1 ImageButton button = (ImageButton) convertView.findViewById(;
2 button.setFocusable(false);


4. Scenario: list item contain TextView

ProblemOnItemClickListener just doesn’t repond.

Reason: I think you have set this attribute to TextView: android:inputType=”textMultiLine”

Solution: just remove that attribute, using android:minLines/android:maxLines instead.

5. Scenario: list item contain a TextView that is linked to website URL or whatever “mailto:” things

ProblemOnItemClickListener just doesn’t repond.

Reason: the TextView overrides focus of list item.

Solution: just remove attribute “android:autoLink” on TextView.


Hope you solve your problems!


Pete Houston

Referenced by:

Leave a comment

Posted by on February 10, 2012 in Android


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: