I am trying to change the color of the text and the background of the preference categories. I searched the webs for answers, but nothing seems to be working. Has anyone successfully changed the color of the preference category attributes? Could I use a custom layout to change looks and feel of the preference category? I need some more direction. Please help
Here is what I have so far:
<style name="Theme" parent="@style/android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">@color/ab_grey</item>
</style>
<style name="PrefCatStyle" parent="Theme">
<item name="android:textColor">@color/text_green</item>
<item name="android:background">@color/pref_back</item>
</style>
colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ab_grey">#adadad</color> <!-- #adadad-->
<color name="text_green">#000000</color>
<color name="pref_back">#FFFFFF</color>
</resources>
Part of my Preference Layout
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Settings"
android:key="settings_category"
style="@style/PrefCatStyle">
And my part Manifest
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme" >
...
<activity
android:name=".SettingsPrefActivity"
android:parentActivityName=".MainActivity"
android:theme="@style/emTextTheme">
Thanks
Preferences in Android are used to keep track of application and user preferences. In any application, there are default preferences that can accessed through the PreferenceManager instance and its related method getDefaultSharedPreferences(Context)
From the menu bar, click File > Settings (on macOS, click Android Studio > Preferences).
PreferencesActivity is a way to easily create preference screens such as those in Android itself, just look under Settings . These can be used inside applications to easily save preferences to SharedPreferences and then easily access these from within your app. See this page for more information on PreferenceActivity.
yes. you can use custom layout. take a look at the answer of this question. Custom PreferenceCategory Headings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With