Reputation: 45
how to disable and enable gridview click event in android programmatically in android
i have tried this, But it is not working
grid.setClickable(false);
grid.setFocusable(false);
grid.setFocusableInTouchMode(false);
Upvotes: 2
Views: 3880
Reputation: 2258
You have setEnabled(false)
to disable click on item. This can be even done in the adapter
by overriding two methods
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
// Return true for clickable, false for not
return false;
}
Upvotes: 5