Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the colour of a header bar

I am creating a simple TicTacToe game and first I created a splash screen. I have easily managed to change the header bar color to orange by simply using activity_splash_screen.xml.

enter image description here

Then I created my homepage called activity_home.xml. And when I click on the bar there it doesn't get active and thus does not allow me to change the colour from blue to orange. Could you please explain to me how this can be fixed

enter image description here

Thanks in advance.

like image 875
Anar Kazimov Avatar asked Nov 26 '25 05:11

Anar Kazimov


1 Answers

In your styles.xml in your AppTheme android:colorPrimary property is responsible for toolbar color change this to your color.

 <style name="AppTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!--   your app branding color for the app bar -->
<item name="android:colorPrimary">@color/primary</item>
<!--   darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<!--   theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/accent</item>

or apply below property to your toolbar

android:background="@color/colorPrimary" 
like image 127
Dipali Shah Avatar answered Nov 28 '25 20:11

Dipali Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!