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
To get the view of a desired preference you can use this:
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
Preference preference=findPreference(“preferenceKey”);
View preferenceView=getListView().getChildAt(preference.getOrder());
//Do your stuff
}
Note: You can not do this in the onCreate
method because it will throw a NullPointerException
.