Change PreferenceActivity text color
13,213
I assume you use an Activity which extends the PreferenceActivity
. You can use the setTheme
method to set a custom theme on your preference screen.
Just define one in res/values/themes.xml
.
It would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.DarkText">
<item name="android:textColor">#000000</item>
</style>
</resources>
Afterwards set it in your Activity:
setTheme(R.style.Theme_DarkText);
![guilherme.minglini](https://i.stack.imgur.com/bNn2W.png?s=256&g=1)
Author by
guilherme.minglini
Updated on June 17, 2022Comments
-
guilherme.minglini about 2 years
I want to change the look of my Android app's preference screen to dark text color. How can I do this? (I´ve already changed the background to white color)
-
Rudey almost 11 yearsWhat if you want to change the text color after the layout is constructed?
-
shantanu over 10 years@MarioB This code can change the title text color of preferences except EditTextPreference. What the name of attribute for EditTextPreference's title (not dialog title)?
-
Display Name almost 10 yearsWon't work when there are more items that the screen can fit, because ListView implements view recycling and doesn't create all views