Faced a strange options menu behavior on Android M.
Menu shadow is implemented with 9 patch and works perfect on previous Android versions.
But on sixth Android it appears only for a while.
Also it look like it appears for a while during close animation.
Menu style is below:
<style name="PopupMenu" parent="Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/shadow</item>
<item name="android:overlapAnchor">true</item>
</style>
Will be thankful for any help in fixing this shadows visibility issue.
Try to remove background from DropDown ListView style
Related
This is really weird. After changing menu background color to black i've seen this bug. Looks like that's android bug. But maybe anyone knows how to solve it.
My changes for menu background color
<style name="CMOptionsMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">#color/blackColor</item>
</style>
<item name="actionOverflowMenuStyle">#style/CMOptionsMenu</item>
I would be very thankful to you for any help.
Here's image with this weird bug: http://i.stack.imgur.com/A3Enn.png
With the help of ActionBarSherlock I try to get my app running on pre 3.0 devices. There is a blue divider in the action bar, which I want to have removed.
I figured out that it isn't a divider, but part of the background graphic of the action bar. To get rid of the blue line I decided to override the background like this:
<style name="MyActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#drawable/black</item>
<item name="background">#drawable/black</item>
</style>
I also set the background in the Java code:
getSupportActionBar().setStackedBackgroundDrawable(this.getResources().getDrawable(R.drawable.black));
As a result the blue line disappears on 4.x devices, but is still visible on 2.3.x devices. How do I get rid of the blue line on 2.3.x devices?
Stupid mistake: I used setStackedBackgroundDrawable instead of setBackgroundDrawable. It works fine with setBackgroundDrawable. This is the correct method to set the background of the action bar. setStackedBackgroundDrawable sets the background of the tab bar.
Seems that the blue line is part of the TabWidget you have there... But if it isn't you can have a look at this webpage: http://jgilfelt.github.io/android-actionbarstylegenerator/
It's a really good Action Bar style generator. Worth a try :)
actionBarDivider attribute belongs to the theme
Remove it like this:
<style name="AppTheme" parent="Theme.Sherlock">
<item name="android:actionBarDivider">#null</item>
</style>
I am using the ActionBar Compatibility, everything is OK, except the fact that by default, the buttons (actions) have some padding around.
How can I alter that padding for specific buttons, remove it, and in some cases adjust.
I managed to resolve this issue by creating a custom layout and attaching it to the ActionBar, by configuring the styles:
<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:displayOptions">showHome|useLogo|showCustom</item>
<item name="android:customNavigationLayout">#layout/actionbar_custom_title</item>
</style>
Now there appeared another problem: Please see this thread if you can help me: Android - Remove "More actions" button from the ActionBar
In my Android application I need to have a black action bar and my content has a white background. The problem is that whenever I set the actionbar with a black background, all my dropdown spinners and textviews have a white background, and I can't see them together with my white content background. If I set the actionbar to white, the dropdown spinners and textviews have a black background and I can see them properly. I tryed customizing the style from the dropdown spinner with android:dropDownSpinnerStyle But i didn't succeed. How can I solve this?
Edit:
I just solved this issue regarding the Dropdown using the following:
<item name="android:dropDownSpinnerStyle">#style/customDropDownStyle</item>
<style name="customDropDownStyle" parent="#android:style/Widget.Holo.Light.Spinner">
</style>
But I still have this issue regarding an EditText, in which I can't see it's background. I just can't find the attribute I should work with in order to solve the issue.
It was much easier to keep the style of the APP in a way that the dropbox/textfields would be visible, but changing only the style of the Actionbar like that:
<item name="android:actionBarStyle">#style/ActionBar.Light</item>
<item name="android:actionOverflowButtonStyle">#android:style/Widget.Holo.ActionButton.Overflow</item>
<item name="android:actionBarTabStyle">#style/customActionBarTabStyle</item>
How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0.
Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText"
Anyone know how to change these?
You can control the appearance of the tabs by using the properties android:actionBarTabStyle, android:actionBarTabBarStyle, and android:actionBarTabTextStyle.
This section in the official developer guide shows a sample xml to customize the action bar's style.
Regarding the text of the menu options check the properties actionMenuTextAppearance and actionMenuTextColor.
As additional info, here's how I found out how to change the blue bar below each tab (the answer above is perfectly good, but I lacked little information that I put here, which might be useful to somebody).
You just need to change the background to a 9 patch drawable.
Here's how it looks like:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Source available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
9 patches available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
I know this was really easy, but again, it might be useful so I'm just dropping the links here.
None of these solutions worked for me. I changed the colors of my tabs as follows:
This is in the themes.xml
<style name="MyApp" parent="android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">#style/MyApp.ActionBar.MyTabStyle</item>
</style>
This is in styles.xml
<style name="MyApp.ActionBar.MyTabStyle" parent="android:style/Widget.Holo.ActionBarView_TabText">
<item name="android:textColor">#00ff00</item>
</style>
This should make your tabs green.
I think that you can use:
<resources>
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionMenuTextColor">#color/...</item>
</style>
</resources>
Regards