- Change color of Navigation Drawer Icon in Android Studio default template
- How to change system navigation bar color
- 9 Answers 9
- How to change inactive color on bottom navigation?
- 5 Answers 5
- How to change color of hamburger icon in material design navigation drawer
- 12 Answers 12
- Android navigation bar icon color
- Answered by:
- Question
- Answers
- All replies
Change color of Navigation Drawer Icon in Android Studio default template
The new default Navigation Drawer Activity template in Android Studio
defines its titles and icons in a menu file activity_main_drawer like this:
The first item in my example uses a red icon:
but when I run the app, the color of the icon remains black.I have tested this for blue, green, yellow and purple icons, but the result is the same.
I read somewhere that the toolbar should use ThemeOverlay.AppCompat.Dark.ActionBar and my app already uses this in the styles.xml file:
and in your theme, add this line:
If you want to set it dynamically you can use:
Based on @ojonugwa ochalifu and @MD’s comment,
You can achieve by writing app:itemIconTint but if you write this, the navigation drawers icon color will also be changed. The simple and easy solution that I found after lots of R&D is that you have define #FFE730 in theme of AppBarLayout or if you using Toolbar only without AppBarLayout , you can also write #FFE730 in theme or popupTheme of Toolbar in your xml.
This will also change the color of activity’s back arrow as well.
Hope this helps you all who are facing this type of issue.
In my case, I was having a style
and have applied the theme to the Appbar layout, so programatically chaining color didn’t work.
So, try removing any styles that you applied, in case you are not able to change the color of the icon and then try the above given solutions.
This works for me for changing icon color from the menu xml file which you drag in the app:menu attribute of the NavigationView widget.
Use app:iconTint attribute to set the icon color.
I called this method navigationView.setItemIconTintList(null); in the onCreate so that i can override the default color of the icon items in navigation drawer like this
Then i changed the color of each icon in navigation drawer using this android:iconTint=»@color/metallic_blue» in activity_places_drawer.xml
Hope this answer helps.
I have changed my drawer menu icon color by doing this line of code:
Источник
How to change system navigation bar color
In guidelines of Android 5.0, the navigation bar seems customizable: http://www.google.com/design/spec/layout/structure.html#structure-system-bars
How can I change the navigation bar color? I would like to use a white style.
Screenshots:
Edit: In my resources, I tested the style:
But the buttons are white. I would like the same renderer as the second image.
9 Answers 9
Starting from API 27, it is now possible to use the light style of the navigation bar:
If set, the navigation bar will be drawn such that it is compatible with a light navigation bar background.
For this to take effect, the window must be drawing the system bar backgrounds with windowDrawsSystemBarBackgrounds and the navigation bar must not have been requested to be translucent with windowTranslucentNavigation. Corresponds to setting SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR on the decor view.
Источник
How to change inactive color on bottom navigation?
I can’t change inactive color on my bottom navigation
and this my xml
and this my java
anyone can help?
5 Answers 5
If you are using the BottomNavigationView, the solution could be easy. You just need to create a selector as a ColorStateList, then assign the selector to the «itemIconTint» attribute of the BottomNavigationView.
Create file inside drawable
bottom_nav_icon_color_selector.xml
BotttomNavigationview.xml
Chrislis answer is a good start. However I like to solve this problem via styling and theming. I also used the new material BottomNavigationView for this example.
Create a new file under the color folder, for example: bottom_nav_item_color.xml
Add this line to your base theme located in themes.xml
Add this code to styles.xml
Now the BottomNavigationView should be styled correctly
Источник
How to change color of hamburger icon in material design navigation drawer
I am following this example
and in this example it is showing hamburger icon white,i want to customize it and make it black,but i am not able to find anything to how to change it,can any one tell how to customize it?
12 Answers 12
To change color of hamburger icon you have to open «style.xml» class, then try this code:
So check @android:color/black line. Just change your desired color here.
do it programmatically add this line
1.In Color.xml. #000000
3. Then your main theme class(File name style.xml).I have “AppTheme”.
Overriding colorControlNormal also works.
For that you can proceed as follows:
in the styles.xml add:
finally add this
This works fine when you set app:theme=»@style/MyMaterialTheme»
After a struggle of 2 hours , this post helped me . In Androidhive material example, change primary color to another for getting new actionbar color. this below code is for getting arrow mark on action bar and making custom text. Finally i understood that, arrow icon will be in appcompat resource files but hamburger icon not present in resources. if it is present we can change it at runtime
for changing the home button, i followed @anandsingh answer.
Источник
Android navigation bar icon color
Answered by:
Question
Android navigation bar how to change color of icons ? fixed like white icons
Answers
If you set the Window.AddFlags(WindowManagerFlags.TranslucentNavigation); for bottom navigation bar, Do you want to acheve the transparent bottom navigation bar?
Is that you needs like following screenshot(this button is white, but It cannot be see in the white background)?
If so, you can add following code.
All replies
If you wanto set the specific color for the navigation bar icon color, it cannot be achieved.
i want just white colored of icons so it is not possible?
@ssamix If you want to set the white icons, sure, you can do it. Put the following code in the OnCreate() method of MainActivity.cs
(StatusBarVisibility)SystemUiFlags.LightNavigationBar; //set it to white
«` Here is running screenshot.
unfortunately not showing white same as default like gray
Yes, which color did you set for navigationbar? Due to the icon has a little transparency, so it will not showing the white same as default like white-gray.
I have Window.AddFlags(WindowManagerFlags.TranslucentNavigation); so icons still like a gray not white nothing change when i add your codes same result..
If you set the Window.AddFlags(WindowManagerFlags.TranslucentNavigation); for bottom navigation bar, Do you want to acheve the transparent bottom navigation bar?
Is that you needs like following screenshot(this button is white, but It cannot be see in the white background)?
If so, you can add following code.
@LeonLu said: If you set the Window.AddFlags(WindowManagerFlags.TranslucentNavigation); for bottom navigation bar, Do you want to acheve the transparent bottom navigation bar?
Is that you needs like following screenshot(this button is white, but It cannot be see in the white background)?
If so, you can add following code.
when we set status bar background transparent that text color is invisible because text color is white So i have 3 theme white and 2 colored theme when i set lightstatusbar default is textcolor is always dark text on colored themes too. How to fix thanks.
Источник