ActionBarSherlock 堆叠操作栏样式问题 [英] ActionBarSherlock stacked action bar styling issue

查看:20
本文介绍了ActionBarSherlock 堆叠操作栏样式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么我实现的堆叠的 ActionBar 在最左边的选项卡和屏幕边缘之间有一个间隙.

I can't figure out why the stacked ActionBar I have implemented has a gap between the left most tab and the edge of the screen.

最右边的标签不是这种情况.

This is not the case with the right most tab.

我尝试通过设置 ActionBar 样式来移除分隔线.在玩了一会儿样式之后,似乎我可以覆盖 TabView 样式的属性,但不能覆盖 ActionBarSherlockTabBar 样式.

I tried to remove the dividers by styling the ActionBar. After playing around with styles for a little bit, it seems like I am able to override attributes of the TabView style but not the TabBar style of ActionBarSherlock.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
</style>

然后我意识到我需要包含相同的无前缀属性.

Then I realized I need to include identical unprefixed attributes.

ActionBarSherlock 主题

Due to limitations in Android's theming system any theme customizations must be declared 
in two attributes. The normal android-prefixed attributes apply the theme to the native 
action bar and the unprefixed attributes are for the custom implementation. Since both 
theming APIs are exactly the same you need only reference your customizations twice rather 
than having to implement them twice.

但我尝试包含相同的无前缀属性,但这对我不起作用.

But I tried to include identical unprefixed attributes but that didnt work for me.

我尝试包含相同的无前缀属性.

I tried to include identical unprefixed attributes.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
    <item name="divider">@null</item>
    <item name="showDividers">none</item>
    <item name="dividerPadding">0dip</item>
</style>

但是会报错

Error: No resource found that matches the given name: attr 'dividerPadding'.
Error: No resource found that matches the given name: attr 'showDividers'.

然后我删除了这两个属性并尝试再次运行它,但我仍然看到标签栏分隔符.

So then i removed those two attributes and tried to run it again, but i still see the tabbar dividiers.

<style name="ActionBarTabBarStyle.Dark" parent="@style/Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="android:showDividers">none</item>
    <item name="android:dividerPadding">0dip</item>
    <item name="divider">@null</item>
</style>

在我的 AndroidManifest.xml 文件中,我包含了

In my AndroidManifest.xml file, I included

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18"/>

对可能出现的问题有任何建议或想法吗?

Any suggestions or thoughts about what may be the issue?

我也试过

<style name="Theme.Dark" parent="@style/Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarDivider">@null</item>
    <item name="android:actionBarDivider">@null</item>
</style>

但这也没有去除分隔线.是否有其他属性覆盖这些属性?

But this didn't remove the dividers either. Is there another attribute which overrides these attributes?

推荐答案

我会接受任何涉及保留 ActionBarSherlock 的答案,但是,我删除了这个库,现在我只使用支持库,不再拥有它间距问题.我想 ActionBarSherlock 可能有问题.但由于它不再受支持,我认为最好的解决方案就是使用支持库.

I will accept anyone with an answer that involves keeping ActionBarSherlock, however, I removed this library and now I am just using the support libraries and am no longer having that spacing issue. I guess there might be an issue with ActionBarSherlock. But since it is no longer being supported I think the best solution is just to use the Support libraries.

这篇关于ActionBarSherlock 堆叠操作栏样式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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