How to add padding to actionbar overflow menu items? - android

I am trying to increase the size of the popup menu items in my toolbar's overflow menu. I've managed to increase the text size with the following in the base application theme.
<item name="android:textAppearanceLargePopupMenu">#style/menu_item</item>
And the following style.
<style name="menu_item" parent="Base.TextAppearance.AppCompat.Widget.PopupMenu.Large">
<item name="android:textSize">#dimen/text_regular</item>
</style>
Now, however, I'm stuck trying to get the padding right, as the items appear too close together, as well as there is very little space on either edge of the popup menu overall.
Popup Menu:
Things I have tried:
Adding padding to the menu_item style.
Adding various different style items to the base theme with the desired padding.
actionButtonStyle: No effect.
popupMenuStyle: No effect.
listMenuViewStyle: No effect.
Adding the following to the base theme. This did work to separate the items from each other, however the side padding obviously remained unchanged, and as a result looked disproportionate.
<item name="android:listPreferredItemHeightSmall">64dp</item>

Related

Change one menu item size in BottomNavigationView

I've bottom menu bar that has 4 items from which one has to look differently (not depending on which item is selected/not). One item has to have bigger icon size.
Currently I'm styling my elements like this:
<style name="BottomNavigationView">
<item name="itemIconTint">#color/gray</item>
<item name="itemIconSize">26dp</item>
</style>
However, itemIconSize is affecting all menu items and not one specific. How to change icon size for specific menu item?

Style Android ActionMode bar

I'm trying to style the ActionMode bar. I want the bar to remain the same except for some margin on the right (end).
<style name="GalleryActionMode" parent="#android:style/Widget.Material.ActionMode">
<item name="android:paddingEnd">56dp</item>
<item name="android:layout_marginEnd">56dp</item>
</style>
I'm not interested in the padding, but I used it as a test and the padding adjustment works. Margin, however, has no effect. I imagine this might be related to some unusual way it enters the existing layout. Is there some way to style the layout of the ActionMode bar?
I could not find a way to do this natively, but in my searching I found a great (and tiny) library that can be used as a replacement for the CAB that behaves more like a toolbar. It was easily customizable and almost plugs right into the existing CAB model.
https://github.com/afollestad/material-cab/

Action bar action button icon size

Our app uses Action Bar Sherlock, and it has a theme like such:
<style name="Theme.MyApp.Default" parent="#style/Theme.Sherlock.Light">
<item name="actionButtonStyle">#style/MyApp.SherlockActionBar.Light.ActionButton</item>
<item name="android:actionButtonStyle">#style/MyApp.SherlockActionBar.Light.ActionButton</item>
</style>
<style name="MyApp.SherlockActionBar.Light.ActionButton" parent="#style/Widget.Sherlock.Light.ActionButton">
<item name="android:maxHeight">20dp</item>
<item name="android:maxWidth">20dp</item>
</style>
Where Theme.MyApp.Default is the default theme for the app.
I need to set the icons for the action buttons (#2 on this image) to be a specific size. When I set the height/width/scaleX/scaleY/scaleType/padding properties however, the icon on the button still maintain what looks like their pixel size. The text part of the action button does seems to adhere to the setting though. Could it just be a compound drawable on a textview?
How can I set the size of the icon on the action bar?
Action bar icons for phones should be 32x32 dp.
Action bar icons are graphic buttons that represent the most important actions people can take within your app. Each one should employ a simple metaphor representing a single concept that most people can grasp at a glance.
you refer that link here
Have you cleaned your project and then run?
and you can specify action item height in main.xml(actionbar menu layout ) also though contrl space wont wrk its like normal height prperty.
whenever changing styles you have to clean and run the project
More and more evidence points to the fact that the menu on the action bar is a compound drawable. (Setting the property android:drawablePadding moves the icon from the text.) And seeing that you can't scale the image in XML for a compound drawable, this doesn't seem possible at the moment.

Android app and Actionbar with different themes

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>

Adding style to ActionBar drop down spinner makes it not a drop down

I'm using this tutorial:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
I set a drop down list theme like this
<!-- style the list navigation -->
<style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner.DropDown.ActionBar">
<item name="android:textColor">#ffffff</item>
</style>
and now pressing the spinner causes it to show up centered on the screen instead of as a drop down. Has anyone run into this? I'm using exactly what they said in the example. Even if I remove the text color and just have the empty style that is based on the parent, the spinner appears in the middle of the screen. Has anyone discovered a way to fix this?
Edit: One more thing I forgot to mention, the style does not even update the text to be white.
Found the solution, the parent is incorrect in the example. It should be:
parent="android:style/Widget.Holo.Light.Spinner"

Categories

Resources