Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listview itemclick not work

  1. I have a ListView in my ListView show ImageButton.

  2. I set focusalble "false" and focusableInTouchMode "false" to ImageButton.

  3. I set ListView.OnItemClickListner. When I run my project It's show my ListView.

  4. But When I click on Listview It's not working.

  5. Then I remove ImageButton in layout and run my project again when i click ListView It' work

  6. What wrong ?

like image 326
user2955394 Avatar asked Nov 26 '13 04:11

user2955394


1 Answers

android:focusable="false"
android:focusableInTouchMode="false"

doesn't work for ImageButton.

In your layout xml, add this property to root layout

android:descendantFocusability="blocksDescendants" 

It works perfectly for a listview that has ImageButton.

like image 71
Pankaj Arora Avatar answered Sep 20 '22 11:09

Pankaj Arora