如何删除动作条图标间距

问题描述:

再一次我打与动作条样式SDK 14以上。我试图消除/减少标签之间的间隔图标,因为默认的间距并不在我的设计合身。目前,我的风格是这样的:

Once again I'm fighting with ActionBar styles for SDK 14 and above. I'm trying to remove/reduce spacing between Tab icons since the default spacing does not fit well in my design. Currently my style looks like:

       <style name="sMain" parent="@android:style/Theme.Holo">
    <item name="android:actionBarStyle">@style/mTabAreaBackground</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle</item>
</style>

<style name="mTabAreaBackground" parent="@android:style/Widget.Holo.ActionBar.Solid">
    <item name="android:backgroundStacked">#2b2f33</item>
</style>

<style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
    <item name="android:background">@android:color/transparent</item>
    <!-- below attributes have no effect -->
    <item name="android:width">0dp</item>
    <item name="android:height">0dp</item>
</style>

我删除通过它透明的,因为我的标签图标已经有一个激活的标签指示。我以为,标签图标之间的间隔在某种程度上涉及到标签的指标,这是仍然存在,虽然我做了透明的。因此,我想申请为0的宽度和高度相同的风格(从风格/ Widget.Holo.ActionBar.TabView继承)。我不知道如果我的假设是不正确的或者说我做错了什么,我也没找到相关选项卡图标之间调整间距的任何文档/例子。

I "removed" the active Tab indicator by making it transparent since my Tab icons already have one. I assumed that the spacing between Tab icons was somehow related to the Tab indicator, which was still there though I made it transparent. Therefore I tried to apply a width and height of 0 in the same style (inherited from style/Widget.Holo.ActionBar.TabView). I don't know if my assumption was incorrect or I'm doing something wrong, I also could not find any documentation/examples related to adjusting spacing between Tab icons.

任何建议都是AP preciated。

Any suggestions are appreciated.

AFAIK,间距是因为填充 TabView的。 你应该改变在 TabView的类似下面的填充。

AFAIK, the spacing is because of the padding on the TabView. You should changing the padding on the TabView something like below.

<style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
    <item name="android:background">@android:color/transparent</item>

    <item name="android:paddingLeft">2dp</item>
    <item name="android:paddingRight">2dp</item>
</style>

上的默认填充的 TabView的似乎16DP。