ActionBarSherlock - How to set the padding of each actionbar's icon?

此生再无相见时 提交于 2019-11-26 07:40:01

问题


How can I make the icons of the actionbar using ActionBarSherlock closer or further away from each other? Something like android:layout_marginLeftor android:paddingRight?

If I just add the icons on the actionbar they are further away compare to the screenshot of Soundhound below:

\"SoundHound\"

my 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>


回答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>

The default value of android:minWidth for the ActionBar buttons is 56dip. Don't forget to set @style/AppTheme as the Activity's theme.



来源:https://stackoverflow.com/questions/10759282/actionbarsherlock-how-to-set-the-padding-of-each-actionbars-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!