Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change PreferenceActivity text color

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)

like image 1000
guilherme.minglini Avatar asked Apr 06 '11 19:04

guilherme.minglini


1 Answers

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);
like image 130
MarioB. Avatar answered Nov 13 '22 02:11

MarioB.