0

I am having an Activity that extends the AppCompatActivity. I am using the theme Theme.AppCompat.Light.DarkActionBar. Now, the text color of the TitleText in the ActionBar shows up black. I want to set this color to white.

How can this be possibly achieved ? Do I change the theme to something else (if yes then what) or can I change the color by making changes through the ThemeEditor available in the latest version of the Android Studio or can something be done with the getSupportActionBar() programmatically ?

Parth Kapadia
  • 433
  • 2
  • 18
  • http://stackoverflow.com/questions/5861661/actionbar-text-color follow this link – saeed Nov 09 '15 at 04:20
  • http://stackoverflow.com/questions/9920277/how-to-change-action-bar-title-color-in-code?rq=1 – Ed. Nov 09 '15 at 05:45

3 Answers3

0

I personally chose the programmatical way.

In your code, you can assign a custom layout to your ActionBar.

Like this:

android.support.v7.app.ActionBar mActionBar = getSupportActionBar();
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.setDisplayUseLogoEnabled(false);
mActionBar.setDisplayHomeAsUpEnabled(false);
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setDisplayShowHomeEnabled(false);


ViewGroup actionBarLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.topbarclassic,null);
mActionBar.setCustomView(actionBarLayout);

Then just change the text color of your textview containing the text inside the ActionBar as following:

        android:textColor="#FFFFFF"
Virthuss
  • 3,142
  • 1
  • 21
  • 39
0

You can simply change the action bar tittle color using this code You add below code to your Oncreate method

setTitleColor(YOUR COLOR);

Hope this helps.

Andrew Johnson
  • 13,108
  • 13
  • 75
  • 116
saeed
  • 1,935
  • 1
  • 18
  • 33
0

Try to do this way in your Activity

getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#DCDCDC"))); 
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96