开发者

Disabled item in spinner list

开发者 https://www.devze.com 2023-03-18 13:07 出处:网络
I have a question for You ! I have 50 item开发者_运维技巧s in my spinner, can I disabled for example sixth item in my list ?You can get the item from the array in your ListAdapter based on its positi

I have a question for You !

I have 50 item开发者_运维技巧s in my spinner, can I disabled for example sixth item in my list ?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消