Is there a way to reduce the spacing between the Action Item Icons on Action Bar?

后端 未结 8 1888
渐次进展
渐次进展 2020-11-29 23:49

I wanted to reduce the spacing bettween Action Item icons added to the ActionBar. Is there a way we can do this?

相关标签:
8条回答
  • 2020-11-30 00:30

    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.

    0 讨论(0)
  • 2020-11-30 00:37

    If you are creating a custom ActionBar, you can add custom spacing, between elements, if you want to move items closer to each other, you can use negative values for your attributes. Like this pseudo-code (in your layout xml file):

    <ImageView 
    android:layout_marginLeft="-2dp"
    
    0 讨论(0)
提交回复
热议问题