I want to change the text color in android preferences fragment. I am currently using a custom theme to change the checkbox image, background, onClick highlighting and it all works great...besides the text color. I don't want to use a default theme, I want to have my own theme so it all looks how I want to but just change the text color, can someone please help.
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="selectedTextStyle">
<item name="android:textSize">18sp</item>
</style>
<style name="buttonTextStyle">
<item name="android:textSize">20sp</item>
</style>
<style name="PreferencesTheme" >
<item name="android:windowBackground">@drawable/lists_background</item>
<item name="android:listViewStyle">@style/listViewPrefs</item>
<item name="android:checkboxStyle">@style/MyCheckbox</item>
</style>
<style name="MyTextAppearance" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/black</item>
</style>
<style name="listViewPrefs" parent="@android:Widget.ListView">
<item name="android:listSelector">@layout/list_selector_master</item>
<item name="android:textAppearance">@style/MyTextAppearance</item>
</style>
<style name="MyCheckbox" parent="android:Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/btn_check</item>
</style>
</resources>
Manifest:
<activity
android:name="com.package.SettingsActivity"
android:theme="@style/PreferencesTheme"
android:configChanges="keyboard|orientation" >
</activity>
Activity:
import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceFragment;
public class SettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
}
public static class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
}
}
}
<item name="android:textAppearanceLarge">@style/MyTextAppearance</item>
did not seem to do the trick. – Fanfani