问题描述:

I am having to display a dialog box which contains some list of items.it has list of items and a checkbox.

User can select one or multiple items . On click of OK, the selected items is stored into Array.

Upon opening the dialog box again, I want to disable the previously selected items and make it grey out or non-selectable.

So second time, the dialog box should show all items but the previously selected items should be greyed out.

How to achieve this feature. I feel, i can search the array of selected items, but I want help on the UI side to show disabled or grey out of the items in the list shown in the dialog box

网友答案:
View getView(){
    // blah blah + inflating view
    if( isItemSelected(position) ){
        view.setBackgroundColor(Color.parseColor("#808080"));
    }
    // more blah blah
    return view
}  

You can use the setBackgroundColor() to set the view to a grey-ish color.

Sets the background color for this view.

Also have a look at isEnabled() method of the BaseAdapter class.

相关阅读:
Top