Disable item focus in ListView
How can I disable the focus from an Item in a ListView
when I click on开发者_高级运维 it, so that there is no focus on click?
Here is your answer for disabling the focus of ListView. Override isEnabled(int position) method in your Adapter and return false.
@Override
public boolean isEnabled(int position) {
return false;
}
Try using listview.setItemsCanFocus(false)
this will disable items gaining focus at all.
override below method to disable/enable list rows...
@Override
public boolean isEnabled(int position) {
//Write your code here......
return super.isEnabled(position);
}
Just override a simple method in your class which extends the BaseAdapter.This will definitely help you.Please don't forget to upvote.Enjoy.. :)
@Override
public boolean isEnabled(int position) {
return false;
}
Try this...
add this snippet to your Adapter class.
@Override
public boolean isEnabled(int position) {
if (position == 3) { // 3 is the disable list item here.
return false;
}
return true;
}
精彩评论