The primary color of my application is white and hence my navigation bar color is also white. My problem is that navigation bar buttons are also white in color. How do I make sure that buttons are visible in white background. The app theme I have used is Theme.AppCompat.Light.DarkActionBar.
I have tried using different theme but none seem to be working so far.
Can anyone tell me how I could resolve this issue?
For Android Oreo and above you can try this:
View.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS but not FLAG_TRANSLUCENT_NAVIGATION.
You can also refer here for more details: https://developer.android.com/reference/android/view/View.html#SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
Also there is another approach:
you can achieve it by placing this in your theme:
<item name="android:windowLightNavigationBar">true</item>
Related
I have created 2 fragments and made them overlap using bottom sheet. First one fragment opens, then the second framgment opens, but when the 2nd fragment is closed,the colour of the status bar icons change to white if the status bar background is white and same for dark.
How do I fix this? Or how do I change the colour of status bar icons?
I have read the docs and read about WindowInsetsController but this will do it for android R only. My issue persists for all versions.
Please help.
You can't change the icons with a specific color but with that in your styles.xml file you can make it light or dark. Keep in mind that it only works API 23 and above.
<item name="android:windowLightStatusBar">true</item>
More references or ways of individual solutions you can find at this post.
I apologize to ask this question once because the previous solution couldn't address my problem.First I have set my style file with:
<item name="android:windowTranslucentStatus">true</item>
Then I included that style inside my activity in android manifest file.
After this is done I achieved my transparent status bar.But the activity details gone behind the actionbar. Then some one suggest me to put this code inside my parent view as
android:fitsSystemWindows="true"
This changed my status bar to dark grey(not transparent).I got confused what to do?I just wish to change my status bar to transparent.
From this post's answer. He has a solution to transparent stats/tool bar
Android transparent status bar and actionbar
Actually I am using
#android:style/Theme.Holo.Wallpaper.NoTitleBar
in my android launcher app. But the problem is when I am changing
navigation bar color
for lollipop and above devices, it's not changing. I tried pro-grammatically as well as from styles.xml.
If I am using appcompat theme, then it's working. But I don't wanna use appcompat theme for my launcher app. So what is the reason behind it and give me solution as well.
I have an action bar that has a specific theme to it(some sort of color) that I want to apply to all activities/fragments that looks something like the attached picture.
Then once I click the dropdown, I'd like the dropdown background to be a different color. How would I go about styling that background.
Right now this is theme I have
<item name="toolbarTheme">#style/ThemeOverlay.AppCompat.Dark.ActionBar.WhiteDropDown</item>
Once I click the dropdown menu, the background of the dropdown appears to be black. What should I do to change that?
I've tried creating a subclass of #style/ThemeOverlay.AppCompat.Light and change the entire toolbarTheme to that style. But at the same time, the actionBar texts now all appear in black since its style is Light, and to contrast that, the texts will be black in default. Therefore, I'm wondering if there's any other attribute I can modify just to change the background of the dropdown menu.
I've tried, actionMenuTextColor, actionBarPopupTheme, spinnerDownItemStyle, actionBarItemBackground, actionDropDownStyle, and everything I can think of. Someone please help out!
Thanks!
Is it possible to change overflow icon in code?
I read this solution: Changing overflow icon in the action bar
But I need to make it in code, to select white or grey style during runtime.
Is it possible?
You can only change this in a theme.
One potential solution would be to call setTheme as the very first thing in onCreate with different themes depending on whether you needed white or gray.