Sanny Pathak
Sanny Pathak

Reputation: 45

Disable click event in gridview android

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

Answers (2)

jeramay10
jeramay10

Reputation: 155

try this..

grid.setEnabled(false);

Upvotes: 7

Logic
Logic

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

Related Questions