今天同事问了我一个关于ListView的问题,设置完ItemClickListener之后想要部分内容可以点击部分内容不可以点击,看了一下他使用的adapter是BaseAdapter,然后去查找了一下SDK,其中有一个函数
boolean isEnabled(int position)
Returns true if the item at the specified position is not a separator.
public boolean isEnabled (int position)
Since: API Level 1
Returns true if the item at the specified position is not a separator. ([color=red]A separator is a non-selectable, non-clickable item[/color]). The result is unspecified if position is invalid. An ArrayIndexOutOfBoundsException should be thrown in that case for fast failure.
Parameters
position Index of the item
Returns
True if the item is not a separator
问题顺利解决
boolean isEnabled(int position)
Returns true if the item at the specified position is not a separator.
public boolean isEnabled (int position)
Since: API Level 1
Returns true if the item at the specified position is not a separator. ([color=red]A separator is a non-selectable, non-clickable item[/color]). The result is unspecified if position is invalid. An ArrayIndexOutOfBoundsException should be thrown in that case for fast failure.
Parameters
position Index of the item
Returns
True if the item is not a separator
问题顺利解决
本文解答了一个关于Android ListView的问题,即如何设置ListView中的部分条目不可点击。通过使用BaseAdapter并重写isEnabled(int position)方法,可以实现某些条目的非活动状态。
2131

被折叠的 条评论
为什么被折叠?



