ActionBarSherlock - 如何设置每一个动作条的图标的填充? [英] ActionBarSherlock - How to set the padding of each actionbar's icon?

查看:122
本文介绍了ActionBarSherlock - 如何设置每一个动作条的图标的填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能使动作条的图标的使用ActionBarSherlock 接近或远离对方?像安卓layout_marginLeft 安卓?paddingRight

如果我只是加上他们渐行渐远比较Soundhound下面的截图中的动作条的图标:

我的的themes.xml

 <样式名称=Theme.AstraTheme_Purple父=@风格/ Theme.Sherlock>
    <项目名称=actionBarStyle> @风格/ Widget.AstraTheme_Purple.ActionBar< /项目>
    <项目名称=机器人:actionBarStyle> @风格/ Widget.AstraTheme_Purple.ActionBar< /项目>

    <项目名称=actionButtonStyle> @风格/ Widget.AstraTheme_Purple.ActionButton< /项目>
    <项目名称=机器人:actionButtonStyle> @风格/ Widget.AstraTheme_Purple.ActionButton< /项目>
< /风格>

<样式名称=Widget.AstraTheme_Purple.ActionBar父=Widget.Sherlock.ActionBar>
    <项目名称=机器人:背景> @可绘制/ purple_bar< /项目>
    <项目名称=背景> @可绘制/ purple_bar< /项目>
< /风格>

<样式名称=Widget.AstraTheme_Purple.ActionButton父=Widget.Sherlock.ActionButton>
    <项目名称=安卓了minWidth> 50dip< /项目>
< /风格>
 

解决方案

 <样式名称=AppTheme父=Theme.Sherlock>
    <项目名称=actionButtonStyle> @风格/ MyActionButtonStyle< /项目>
    <项目名称=机器人:actionButtonStyle> @风格/ MyActionButtonStyle< /项目>
< /风格>

<样式名称=MyActionButtonStyle父=Widget.Sherlock.ActionButton>
    <项目名称=安卓了minWidth> 32dip< /项目>
    <项目名称=机器人:填充> 0dip< /项目>
< /风格>
 

Android的默认值:了minWidth 动作条按钮是 56dip 。 不要忘记设置 @风格/ AppTheme 活动的主题。

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:

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>

解决方案

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

这篇关于ActionBarSherlock - 如何设置每一个动作条的图标的填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆