1

I am using a ListView inside of a GridView but I want to disable the onClick handler of the ListView.

How can I do this?

mcnicholls
  • 846
  • 5
  • 10

5 Answers5

2

check this answer disable click

@Override
public boolean isEnabled(int position) {
    return false;
}

@Override
public boolean areAllItemsEnabled() {
    return false;
}
Community
  • 1
  • 1
nathandrake
  • 427
  • 1
  • 4
  • 19
1

You can call setClickable like this:

setClickable(false)

on your ListView object to prevent it responding to click events.

mcnicholls
  • 846
  • 5
  • 10
0

Yo can try to create your subclass of ArrayAdapter with the funcion AreAllItemsEnabled() andd return false.

Hope this helps

oriolpons
  • 1,883
  • 12
  • 20
0

Please try adding android:clickable="false" to your ListView.

Didier Ghys
  • 30,396
  • 9
  • 75
  • 81
-1

Try to type this in layout XML file:

   android:scrollbars="none"
Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
Nitesh Khosla
  • 875
  • 8
  • 20