Friends I have created a listpreferences screen ,and it is working fine but I want to change the color of text appearing on the list and the RadioGroup items. So can anyone help me out.
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<ListPreference
android:entries="@array/gametype"
android:entryValues="@array/gametype"
android:key="listpref"
android:summary=""
android:title="Set Game Level" />
</PreferenceScreen>
This is my preferences screen. After Clicking on listpreferences item it show a dialog box which has three options so i want to change the color of that radiobutton text and the list item text.
here is java code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
SharedPreferences sp=getPreferenceScreen().getSharedPreferences();
Preference pref=findPreference("listpref");
ListPreference lp=(ListPreference)pref;
pref.setSummary(lp.getValue());
sp.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
Preference pref=findPreference(key);
ListPreference lp=(ListPreference)pref;
pref.setSummary(lp.getValue());
}
public void setcolor(int position){
for(int i=0;i<4;i++)
{
if(i==position)
{
list.getChildAt(i).setBackgroundColor(Color.rgb(238, 180, 180));
}
else{
list.getChildAt(i).setBackgroundColor(Color.WHITE);
}
}