I use White Action Bar and i want to use black color icons to Open Navigation drawer and more options button?
I tried using a White Action Bar but i end up getting all the icons or the buttons to be invisible in the Action bar since they are also in white color.
Kindly suggest how can i set color to the Action bar elements, as of now i want to display black icons on the Action bar with shadow.
Voila! I have found the answer.
Just Replace the code in styles.xml
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Light" />
Note: When u use a Light theme, it is understood that you will use only light colours in the action bar and therefore the colour of the text and icons are made dark(black).
Thank me later!
Related
Guys I want to have translucent status bar with black background navigation buttons. Just like Netflix App as shown in picture. I tried really hard to find any way but I failed to achieve this. Any Idea?
Add in styles.xml in Base Application style
Change status bar color : <item name="android:statusBarColor">#color/blackColor</item>
For Translucent status bar : <item name="android:windowTranslucentStatus">true</item>
For navigation bar color : <item name="android:navigationBarColor">#color/blackColor</item>
in layout file use : android:fitsSystemWindows="true" in root layout.
I have an application with a lot of activities, that all use the same theme:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#aaa</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
Activities all have action bar looking like by the lines of:
What I just can't figure out is, how to color action buttons (pencil on the right) to black.
Essentially I want to have white action bar (on screenshot is white just for action button to be visible) with black title, back arrow and action buttons, but I don't want to add Toolbar view to every activity I have.
So, is there a way to color action buttons black by XML?
Create vector icons for your menu items and set their color to black (in your case you won't need to set their color as they are black by default). To create vector asset go to File - New -Vector Asset.
You can also download an icon from the internet as svg file and import it through vector asset creating dialog.
The list of default icons is also available here.
I'd like to know what's the name of the part on top of the action bar (where the time is displayed alongside the battery, wifi, etc), and how can its color be changed ?
Thanks !
That's the status bar.
Just add colorPrimaryDark item to your theme in styles.xml
<item name="colorPrimaryDark">#color/primary.dark</item>
I'm try to developing an app with a navigation drawer from a template found on github.
In style.xml i have:
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#ff0000</item>
<item name="colorPrimaryDark">#0000ff</item>
and the status bar in navigation drawer is ok.
When i click the button it runs this command:
getWindow().setStatusBarColor(Color.GREEN);
Now the status bar color in navigation drawer is no more translucent
How restore status bar color to translucent?
The difference is that the xml defined colors colorPrimary and colorPrimaryDark are not really used to directly set the status bar color.
Actually the statusbar is completely transparent all the time and only the underlaying View is colored. Thats why it can have another color on the left than on the right side (have a look at your second screenshot). If you now call getWindow().setStatusBarColor(..) you indeed color the statusbar directly and over-draw the color of both Views. So it needs to stay transparent!
What you really want to do, is changing the color of the View underlaying the status bar, which is done with the ScrimInsetsFrameLayout class.
Have a look at this question and this class from the library you provided
There you should find all the necessary information to change only the color of the area you want to.
In case you really just want to reset the color:
getWindow().setStatusBarColor(Color.TRANSPARENT);
I've got a toolbar at the bottom of my layout which I would like to be the same color as the action bar. I'm using the Holo Light with dark action bar theme, what is the hex code for this color? Thanks
The action bar's background hex value in the Theme.Holo.Light.DarkActionBar theme is #222222. I picked it from the the image that is used as the action bar background:
<sdk>/platforms/android-17/data/res/drawable-xhdpi/ab_solid_dark_holo.9.png
The dark action bar itself is #030304, and the border beneath it is #33b5e5.
It is also worth noting that, if you want a replica of the action bar on the bottom, it's possible to use a split action bar on API 14+ through use of uiOptions="splitActionBarWhenNarrow".