Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabled item in spinner list

I have a question for You !

I have 50 items in my spinner, can I disabled for example sixth item in my list ?

like image 866
Dawid Sajdak Avatar asked Jul 05 '11 07:07

Dawid Sajdak


1 Answers

You can get the item from the array in your ListAdapter based on its position and call setEnabled(false) in the public getView() method.

Like this:

if (position==10) {
    convertView.setEnabled(false);
}
else{
    convertView.setEnabled(true);
}

You will probably need to override some other methods. Check those posts:

Android ListView child View setEnabled() and setClickable() do nothing
Android: How to disable list items on list creation

like image 183
iDroid Avatar answered Oct 19 '22 13:10

iDroid