I want the change the look of the preferences screen for an app I am working on. On some phones the preferences are very translucent and it is quite difficult to read the preferences scheme, so I am going to change the visuals for it.
My question is how can I apply a theme to the preferences scheme? Or failing that, how can I change the text color that show up for the various preferences.
In my current version, my preferences layout xml file starts with:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffa0a0a0">
This background color gives me an acceptable gray, but I would prefer to use a theme.
I tried putting a applying a couple of different themes in the preferences xml and the preferences layout xml and none of this has shown any effect. I also tried setting andoid:textColor for the individual preferences items and in layout and that had no effect.
So how does one modify the visuals for the preferences scheme (preferably by using a theme)?
thanks in advance,
Jay
A style is a collection of attributes that specify the appearance for a single View . A style can specify attributes such as font color, font size, background color, and much more. A theme is a collection of attributes that's applied to an entire app, activity, or view hierarchy—not just an individual view.
Settings. Under Display Options, tap Theme. Select the theme for this device: Light—White background with dark text.
To change default themes go to File and click on Settings. A new Settings dialog will appear, like this. Under the Appearance & Behaviour -> Appearance, you will find Theme. Choose the right theme from the drop-down and click on Apply and then Ok.
The basic things are:
preferenceScreenStyle
, preferenceCategoryStyle
etc)themes.xml
). For instance in styles.xml they define the Preference.Category
and Preference.PreferenceScreen
styles.<activity android:theme="@style/CustomTheme"...
If you want to inherit the default Android styles and then just override some of them, then add parent="@android:style/Theme"
to the opening <style...
tag of your theme.
Take a look at Applying Styles and Themes for more info.
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