Can I make a ListView item not selectable?

微笑、不失礼 提交于 2019-12-03 01:01:25

It's pretty easy, in your adapter you can override the method isEnabled(int position) and return false for this item.

if you're using custom array adapter just override this method.

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

If you want to get the same effect without having to have a custom adapter, you make the OnClickListener ignore that item when tapped and then set a solid background color for the item's view, so it doesn't highlight when tapped.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!