开发者

Disabling ListItem selectability

开发者 https://www.devze.com 2022-12-19 02:54 出处:网络
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 t

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 lay开发者_开发问答out 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?

Disabling ListItem selectability


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消