Android的动作条夏洛克 - 标签之间删除干脆分 [英] Android ActionBar Sherlock - Remove divider between tabs altogether

查看:113
本文介绍了Android的动作条夏洛克 - 标签之间删除干脆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图去除标签之间的分隔在动作条(实际上是一个ActionBarSherlock)一共;即标签和标签是(我使用的标签平铺图像背景)之间没有缝隙之间没有任何图像。理想情况下,我想在XML中删除,而不是在code中的分频器。

我已经尝试了一些办法,但似乎没有任何合作,如:

 <样式名称=Theme.MyTheme.ActionBarTab父=Widget.Sherlock.ActionBar.TabBar>
    <项目名称=机器人:分> @空< /项目>
    <项目名称=分水岭> @空< /项目>
    <项目名称=actionBarDivider> @绘制/空< /项目>
    <项目名称=机器人:showDividers>没有< /项目>
< /风格>


解决方案

原来我设置错款式。在的android:showDividers 属性的工作,但何时应用到从 Widget.Sherlock.ActionBar.TabBar 风格。这样的XML的相关位是:

 <样式名称=Theme.Client父=Theme.Sherlock.Light.DarkActionBar>
    <项目名称=机器人:actionBarTabBarStyle> @风格/ Theme.Client.ActionBarTabBar< /项目>
    <项目名称=actionBarTabBarStyle> @风格/ Theme.Client.ActionBarTabBar< /项目>
< /风格><样式名称=Theme.Client.ActionBarTabBar父=Widget.Sherlock.ActionBar.TabBar>
    <项目名称=机器人:背景> @绘制/ tab_bar_bg_tiled< /项目>
    <项目名称=背景> @绘制/ tab_bar_bg_tiled< /项目>
    <项目名称=机器人:showDividers>没有< /项目>
< /风格>

I'm trying to remove the divider between the tabs in an ActionBar (actually an ActionBarSherlock) altogether; i.e. no image between tabs and no gap between the tabs either (I'm using a tiled image background in the tabs). Ideally, I'd like the dividers removed in the XML, rather than in code.

I've tried a few approaches, but nothing seems to be working, such as:

<style name="Theme.MyTheme.ActionBarTab" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:divider">@null</item>
    <item name="divider">@null</item>
    <item name="actionBarDivider">@drawable/empty</item>
    <item name="android:showDividers">none</item>
</style>

解决方案

Turns out I was setting the wrong style. The android:showDividers attribute does work, but when it's applied to the style that inherits from the Widget.Sherlock.ActionBar.TabBar style. So the relevant bits of XML are:

<style name="Theme.Client" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="android:actionBarTabBarStyle">@style/Theme.Client.ActionBarTabBar</item>
    <item name="actionBarTabBarStyle">@style/Theme.Client.ActionBarTabBar</item>
</style>

<style name="Theme.Client.ActionBarTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:background">@drawable/tab_bar_bg_tiled</item>
    <item name="background">@drawable/tab_bar_bg_tiled</item>
    <item name="android:showDividers">none</item>
</style>

这篇关于Android的动作条夏洛克 - 标签之间删除干脆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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