Maybe this is not quite an ActionBar problem but the problem is as follows;
I have an EditText and when you long click on the EditText, text selection options appear on ActionBar's position by default. My problem is that, both the texts and background are white, so they cannot be read. Here is the screenshot:
I tried some possible causes of the problem but nothing helped. For example, I tried to change the theme
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
However, any theme with the AppCompat results totally white.
Also I changed the project theme in Android Studio's interface as follows:
However it's still white.
The copy-paste options are there and you can click on them, but how can I make them appear? Another solution on SA suggested manually replacing gray icons. But I believe this is not the usual case in Android and there should be another way. Any ideas?
Related
Like the picture, I set a dark green color, but the light green background appears.
This is the only thing I've set up.
Button's background was set to the colorPrimary of the theme.
So when I changed Button to Image Button, it came out right.
As a result of the test, it seems that the problem is occurring in material design 1.2.1 or higher.
I have to use Theme.MaterialComponents.Light.NoActionBar, so I can't change Theme.
This is a known issue in material design, and found solution adding app:backgroundTint.
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>
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!
I am designing an app with Material Design, but I am having trouble styling the ActionBar.
First of all, I can not get the ActionBar to render a shadow. I have tried setting the elevation in multiple ways:
In the styles.xml (v21):
<item name="android:elevation">4dp</item>
<item name="elevation">4dp</item>
In the onCreate() method
getActionBar().setElevation(4);
However, none of these result in the ActionBar rendering a shadow. Not sure if this is important, but I am running Android 5.0.1 Lollipop. What am I missing in trying to render a shadow? I don't really want to make a drawable shadow and set it as the window background.
Secondly, my ActionBar buttons are square, and when I click on them, the ripple is cut off in a square, while in other apps I have used the mask for the ripples has been circular, and my app had been using round buttons, but recently it changed and I don't know why. Could I have accidentaly changed something making them square?
Thank you
The issue is that u use ActionBar while the other apps use ToolBar. Read about and change your code, everything should work after that.
I'm working on an app which has two activites. The second activity has a back button which provide back navigation.
The problem I have is that the back navigation button takes the background from the toolbar no matter if the toolbar has the "style=" attribute or the "app:theme=".
Here is the toolbar with the "style=" attribute:
http://postimg.org/image/f57zaap4p/
http://postimg.org/image/3u5blxi9l/
An here is the toolbar with the "app:theme=" attribute:
htt.p://postimg.org/image/kkqxgo8d1/
htt.p://postimg.org/image/ofpq5i251/
(Please remove the point from "htt.p" from the last two links - I can't post more than two links)
I want the icons to have a white background. I would appreciate if you can help!
You can style the action overflow button in your styles.xml adding this line:
<item name="android:actionBarItemBackground">...</item>
You can set it as a #drawable or a #color resource. I suggest you to define a selector to manage, e.g, the background color as the icon is pressed.
As for the back arrow, this is, to me, quite an open question. You could take a look at my own question here , where you can also find a selector sample.
Basically you can override the arrow/burger background with
<item name="android:selectableItemBackground">...</item>
but (I fear) it acts as a background for a lot of widgets you might have. In facts, this also overrides actionBarItemBackground, so if you want to use both, the latter is enough.