ActionBarSherlock堆积作用直板造型问题直板、造型、作用、问题

2023-09-12 01:22:17 作者:寂寞是本性

我不明白,为什么堆叠动作条我已经实现了最左边的选项卡,并在屏幕的边缘之间的间隙。

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.

我试图通过造型的动作条删除分隔。使用样式玩弄一点点之后,好像我能够覆盖TabView的风格属性,但 ActionBarSherlock 。

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>

然后我意识到我需要包括相同的未prefixed属性。

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.

不过,我想包括相同的未prefixed属性,但对我来说没有工作。

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

我想包括相同的未prefixed属性。

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>

但它抛出一个错误

But it throws an error

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

于是我删除了这两个属性,并试图再次运行它,但我仍然看到的TabBar dividiers。

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>

在我的Andr​​oidManifest.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.