Android get view of Preference in PreferenceActivity

后端 未结 3 1774
慢半拍i
慢半拍i 2021-01-11 13:56

I would like to get View instance that is used to display specific Preference in my PreferenceActivity, so i can modify its properties, for example:

public          


        
3条回答
  •  误落风尘
    2021-01-11 14:07

    PreferenceActivity inherits the ListActivity class. ListActivity has a method called getListView() which returns the ListView that displays your preferences.

    EDIT: Here is the code in my comment formatted:

    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
           // ... put listener code here 
    });
    

提交回复
热议问题