Reputation: 509
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?
Upvotes: 7
Views: 11374
Reputation: 9442
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;
}
Upvotes: 0
Reputation: 5073
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;
}
Upvotes: 2
Reputation: 24031
override below method to disable/enable list rows...
@Override
public boolean isEnabled(int position) {
//Write your code here......
return super.isEnabled(position);
}
Upvotes: 2
Reputation: 50588
Try using listview.setItemsCanFocus(false)
this will disable items gaining focus at all.
Upvotes: 2
Reputation: 67296
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;
}
Upvotes: 17