ActionBarSherlock - 如何设置每一个动作条的图标的填充?ActionBarShe

2019-05-14 14:28发布

我怎样才能让使用ActionBarSherlock的动作条的图标接近或彼此渐行渐远? 喜欢的东西android:layout_marginLeftandroid:paddingRight

如果我只是添加的动作条的图标,他们是更远比较Soundhound的下面的截图:

themes.xml

<style name="Theme.AstraTheme_Purple" parent="@style/Theme.Sherlock">
    <item name="actionBarStyle">@style/Widget.AstraTheme_Purple.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.AstraTheme_Purple.ActionBar</item>

    <item name="actionButtonStyle">@style/Widget.AstraTheme_Purple.ActionButton</item>
    <item name="android:actionButtonStyle">@style/Widget.AstraTheme_Purple.ActionButton</item>
</style>

<style name="Widget.AstraTheme_Purple.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">@drawable/purple_bar</item>
    <item name="background">@drawable/purple_bar</item>
</style>

<style name="Widget.AstraTheme_Purple.ActionButton" parent="Widget.Sherlock.ActionButton">
    <item name="android:minWidth">50dip</item>
</style>

Answer 1:

<style name="AppTheme" parent="Theme.Sherlock">
    <item name="actionButtonStyle">@style/MyActionButtonStyle</item>
    <item name="android:actionButtonStyle">@style/MyActionButtonStyle</item>
</style>

<style name="MyActionButtonStyle" parent="Widget.Sherlock.ActionButton">
    <item name="android:minWidth">32dip</item>
    <item name="android:padding">0dip</item>
</style>

默认值android:minWidthActionBar按钮是56dip 。 不要忘了设置@style/AppTheme作为Activity的主题。



文章来源: ActionBarSherlock - How to set the padding of each actionbar's icon?