Android & Wordpress Help center

Disable elements of ListView

In order to disable few elements of a list view, you need to implement your own ArrayAdapter by extending the ArrayAdapter class.

In this Custom ArrayAdapter class one can override areAllItemsEnabled() method to return false.Also, override the method isEnabled()  and return false for the items that you don’t wish to enable; for others return true.

Code :


public boolean areAllItemsEnabled() {

    return false; } 

public boolean isEnabled(int position){

  if(<your condition here>){
   return false; // disable the item
 return true;  // enable the item


Single Post Navigation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: