How to set text color in android app for all text?


I want to define a default text color for my android app.

I have a base activity class, that all activities are extended from it and I thought this might be a good place to define the colors.

If not what is a better solution? Maybe styles?

Trouble is this, all is new to me, so feel free to advise me and provide code snippets and explanations as well.

This is what my base class looks like. As you can see it’s pretty empty


import android.os.Bundle;

public class BaseActivity extends Activity {
    //set up app preferences here


Yes you are right you can make that using style. Or you can use TextView.getTextColors().getDefaultColor() for set default text color. Actually I never used this but I think it may be help you.

For style

<style name="TextColor">
    <item name="android:textColor">#00FF00</item>

Then in layout file

<TextView  style="@style/TextColor" />

Answered By – anddev

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published