I can't believe it took me so long to figure this out!
In the end, it occurred to me to use the Android Device Monitor. I went to Tools> Android> Android Device Monitor. When this started, I clicked the package name of my application on the "Devices" tab, and then clicked on the "Hierarchy dump-view for the user interface" button (which looks like several phones stacked on top of each other) at the top of the "Devices" tab. This showed me the interface of my current screen. Then I could click on the Refresh button and find that it was not two Views next to each other - it was one TextView with DrawableLeft. I know, I know, this is obvious and should have been the first thing I thought of.
I already found ActionBarSherlock - How to install an addition to the icon of each action bar? but that didn't work for me. However, this gave me an example of what I need - changing the ActionButton style.
Now that I realized that it was a TextView with DrawableLeft, I knew that I needed to change DrawablePadding. This is the change I needed to make for styles.
To change the ActionButton theme, I needed to add this to my styles. xml:
<style name="ActionButton" parent="@android:style/Widget.ActionButton"> <item name="android:drawablePadding">@dimen/action_button_padding</item> </style>
dimen.xml:
<dimen name="action_button_padding">4dp</dimen>
Then change the theme of the style.xml section:
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:actionButtonStyle">@style/ActionButton</item> </style>
And it just works! No need to set a custom ActionProvider, edit the image to add distance to the image file, or use additional XML files for each button.
source share