I am using the app theme Theme.Black
in my app. In this theme the action bar is gray. How I can change color of my action bar? This is my attempt:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="mytheme" parent="@android:style/Theme.Black" >
</style>
<style name="Widget.MyApp.ActionBar" parent="@android:style/Widget.ActionBar">
<item name="android:background">@android:color/black</item>
</style>
</resources>
However, it doesn't work. Any ideas?
This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
Option 1) The quick and easy way (Toolbar only)setTitleTextColor(Color. WHITE); toolbar. setSubtitleTextColor(Color. WHITE);
Go to the app > res > values > themes > themes. xml file and add the following line inside the <resources> tag. In the activity's onCreate() method, call the activity's setSupportActionBar() method, and pass the activity's toolbar.
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable("COLOR"));
it worked for me here
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