I wanted to reduce the spacing bettween Action Item icons added to the ActionBar. Is there a way we can do this?
You'll want to add android:fitsSystemWindows="true" to the parent layout of the Toolbar to ensure that the height of the activity is calculated correctly. When using the support library, make sure that you are importing android. support. v7.
All action buttons and other items available in the action overflow are defined in an XML menu resource. To add actions to the action bar, create a new XML file in your project's res/menu/ directory. The app:showAsAction attribute specifies whether the action should be shown as a button on the app bar.
The ActionBar, now known as the App Bar, is a consistent navigation element that is standard throughout modern Android applications. The ActionBar can consist of: An application icon. An "upward" navigation to logical parent.
use a custom android:actionButtonStyle.
<item name="android:actionButtonStyle">@style/ActionButtonStyle</item>
and the magic is here:
<style name="ActionButtonStyle" parent="@android:style/Widget.Holo.Light.ActionButton"> <item name="android:minWidth">0dip</item> <item name="android:paddingLeft">0dip</item> <item name="android:paddingRight">0dip</item> </style>
normaly minWidth is set to 56 dip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With