Ad

Disabling ListItem Selectability

- 1 answer

As you can see from the screenshot below I have a ListView with multiple items in it. No matter what I try I can't seem to make the list item's not be selectable. I've tried all of the follow (in the XML layout for the ListView), but the items are STILL selectable with both a finger and the scroll wheel.

android:clickable="false" 
android:longClickable="false" 
android:focusable="false" 
android:focusableInTouchMode="false"

Any suggestions?

activity

Ad

Answer

Each row of aListView are selectable, you might be interested in TableLayout, where items are not selectable, to achieve what you are looking for.

EDIT:

After searching a bit more, I found this archive post which suggests you try:

public boolean areAllItemsEnabled() {
   return false;
}

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

Hopefully that works for you.

Ad
source: stackoverflow.com
Ad