I'm trying to understand how the theme works in android. I don't know why colorPrimaryDark won't work with me or maybe i'm doing it wrong.
I tried this set and my action bar turns red because of colorPrimary:
<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">#FF0000</item> <item name="colorPrimaryDark">#0000FF</item> <item name="colorAccent">#00FF00</item> <item name="actionMenuTextColor">#0000FF</item> </style>
I tried to remove the colorPrimary and it turns black (which I thought it will use blue because of colorPrimaryDark:
<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimaryDark">#0000FF</item> <item name="colorAccent">#00FF00</item> <item name="actionMenuTextColor">#0000FF</item> </style>
I tried to remove the colorPrimaryDark and left the colorPrimary and it turns red again:
<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">#FF0000</item> <item name="actionMenuTextColor">#0000FF</item> </style>
I don't know if i'm using it in wrong way or it's not really changing at all. Can anyone tell me the difference among them?
I also tried actionMenuTextColor to change the text color in actionBar but nothing happened. I found out the solution using parent="Theme.AppCompat.Light.DarkActionBar" instead of parent="Theme.AppCompat.Light" alone. But of course it will only turn into white. I'm still trying to make it in different color if there is any way.
colorPrimary and colorSecondary represent the colors of your brand. colorPrimaryVariant and colorSecondaryVariant are lighter or darker shades of your brand colors. colorSurface is used for “sheets” of material (like cards and bottom sheets) android:colorBackground is the window background color of your app.
A color that passes accessibility guidelines for text/iconography when drawn on top of the primary color. The secondary branding color for the app, usually an accented complement to the primary branding color.
It is a color used to draw attention.
you can use following link to setup your style.
https://blog.xamarin.com/material-design-for-your-xamarin-forms-android-apps/
https://material.io/develop/android/theming/color
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