This question already has answers here:
How to change action bar size
(5 answers)
Closed 7 years ago.
I'm trying to change the height of my ActionBar, but it won't work. I have tried to set the height using the android:actionBarSize and android:height attributes. But nothing workds. Here is my theme.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyActionBarTheme"
parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="android:itemBackground">#color/green_2x</item>
</style>
<style name="MyActionBar"
parent="Widget.AppCompat.Light.ActionBar">
<item name="android:background">#drawable/actionbar_background</item>
<item name="background">#drawable/actionbar_background</item>
<item name="android:height">10dp</item>
</style>
</resources>
Any ideas to change the height of the ActionBar?
This might help you,
<style name="ActionBarStyle" parent="Widget.AppCompat.Light.ActionBar">
<item name="android:background">#drawable/actionbar_background</item>
<item name="background">#drawable/actionbar_background</item>
<item name="android:height">10dp</item>
<item name="height">10dp</item>
</style>
<style name="Theme.AppCompat.Light.DarkActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar"/>
<style name="Base.Theme.AppCompat.Light.DarkActionBar" parent="Base.Theme.AppCompat.Light">
<style name="Base.Theme.AppCompat.Light" parent="Base.V7.Theme.AppCompat.Light">
<style name="Base.V7.Theme.AppCompat.Light" parent="Platform.AppCompat.Light">
And the Base.V7.Theme.AppCompat.Light contains
<item name="actionBarSize">#dimen/abc_action_bar_default_height_material</item>
So, you need to change only actionBarSize in your main theme.
Related
This question already has answers here:
How to change the status bar color in Android?
(29 answers)
Closed 5 years ago.
I want my app to look like this :
What I have:
Any help would be deeply appreciated!
You need to change color primary and color primary dark in style.xml where your app theme color code was written
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimary</item>
<item name="colorAccent">#color/colorPrimary</item>
change from colorPrimaryDark to colorPrimary to all the item in style.xml file.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimary</item>
<item name="colorAccent">#color/colorPrimary</item>
</style>
I have searched a solution for this and I tried multiple solutions but none of them worked for me.
Here is my style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
How can I change the 3 dot menu icon color?
1. Add a new drawable of three dot menu of the color you want in the project.
2. Create a new style
<style name="OverFlow" parent="Widget.AppCompat.ActionButton.Overflow">
<item name="android:src">#drawable/overflow</item>
</style>
3. Apply that style to your main style theme<item name="actionOverflowButtonStyle">#style/OverFlow</item>
I'm following the Android Documentation and have correctly copied this code:
<resources>
<style name="CustomTheme"
parent="Base.Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionMenuTextColor">#color/actionbar_text</item>
</style>
<style name="MyActionBar"
parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#color/background</item>
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionbar_text</item>
</style>
</resources>
I've set the activities manifest to "CustomTheme" and have the right information in strings.xml so I don't see what the problem would be. Any help would be appreciated. Thanks.
Try removing the android: tag and also, you have to set the Parent ActionBar to AppCompat's ActionBar.
<style name="CustomTheme"
parent="Base.Theme.AppCompat.Light">
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionMenuTextColor">#color/actionbar_text</item>
</style>
<style name="MyActionBar"
parent="Base.Widget.AppCompat.ActionBar">
<item name="background">#color/background</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionbar_text</item>
</style>
I attempted the following:
<style name="myAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/primaryColor</item>
<item name="colorPrimaryDark">#color/primaryColorDark</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#android:color/white</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar.Solid">
<item name="titleTextStyle">#style/MyTitleTextStyle</item>
</style>
<style name="MyTitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionbar_text_color</item>
</style>
To change my toolbar text color to white, but it's still black!
What do I need to change?
Are you sure that you are using Toolbar? If yes, then your myAppTheme should extend from Theme.AppCompat.NoActionBar ... Toolbar is a replacement of ActionBar. Therefore if you want to use it then you must remove ActionBar styles from your xml.
I suggest you read this blog post. And here is a nice implementation on how to change title color.
I searched many solutions and implemented solution of Jake Wharton
My style.xml code is
<resources>
<style name="AppBaseTheme" parent="android:Theme.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:homeAsUpIndicator">#drawable/aeromyorders</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/bg_actionbar</item>
<item name="android:homeAsUpIndicator">#drawable/up_caret</item>
</style>
</resources>
but still my Actionbar up button is default what i have to do now? i also replaced Vaues-v11 style also.. My Min SDK is 15 Max 19 in Manifest
Try this code in Your Activity. set Your Custom Back Button
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_actionbar_screen_back);
Hope it helps...