如何完全在动作条中删除选项卡指示器 [英] how to completely remove tab indicator in an ActionBar

查看:165
本文介绍了如何完全在动作条中删除选项卡指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用动作条在我的 FragmentActivity (分SDK = 14),我需要删除的活动标签指示灯(见下图),因为我有自己的图标,用于指示标签被激活。我一直在阅读了大量的风格相关的东西,但是没有发现任何解决方案。任何建议如何这个指标才能彻底清除?

解决

的工作方案是如下:

 <样式名称=ActionBarTabStyle父=@安卓风格/ Widget.Holo.ActionBar.TabView>
    <项目名称=机器人:背景> @android:彩色/透明< /项目>
< /风格>
 

,然后加入到活动方式:

 <项目名称=机器人:actionBarTabStyle> @风格/ ActionBarTabStyle< /项目>
 

解决方案

从<一个href="http://stackoverflow.com/questions/11273888/how-to-change-the-color-of-tab-underbar-in-actionbarsherlock">How改变标签下划线的颜色actionbarsherlock ,貌似指标是一个可拉伸的一部分。我还没有试过,但你也许可以改变@绘制/ tab_selected和@可绘制/ tab_selected_focused你自己的绘制。 (让它平原,如果你不想要的指标。)希望这有助于。

编辑:

注:没有测试

您可以尝试下面的<一个href="http://stackoverflow.com/questions/11273888/how-to-change-the-color-of-tab-underbar-in-actionbarsherlock">the回答并改变从tab_selected_focused到tab_unselected_focused,也从tab_selected到tab_unselected。

 &LT;! - 非聚焦状态 - &GT;
&LT;项目安卓state_focused =假的Andr​​oid版本:state_selected =假的Andr​​oid版本:STATE_ pressed =假机器人:可绘制=@可绘制/ tab_unselected/&GT;
&LT;项目安卓state_focused =假的Andr​​oid版本:state_selected =真正的机器人:STATE_ pressed =假机器人:可绘制=@可绘制/ tab_unselected/&GT;

 &LT;! - 聚焦国家 - &GT;
 &LT;项目安卓state_focused =真正的机器人:state_selected =假的Andr​​oid版本:STATE_ pressed =假机器人:可绘制=@可绘制/ tab_unselected_focused/&GT;
 &LT;项目安卓state_focused =真正的机器人:state_selected =真正的机器人:STATE_ pressed =假机器人:可绘制=@可绘制/ tab_unselected_focused/&GT;
 

编辑2: 您可以尝试ActionbarStyleGenerator样式的动作条。

  

如何:   使用用户界面来选择颜色为不同的项目   完成以上操作后点击下载.ZIP   该ZIP文件包含你已经在你的项目RES /布局和资源复制资源的文件/文件夹drawableXXXX

I use an ActionBar in my FragmentActivity (min SDK = 14) and I need to remove the active Tab indicator (see picture below) since I have my own icons for indicating which Tab is active. I've been reading a lot of style-related stuff, found no solution however. Any suggestions how this indicator can be completely removed?

SOLVED

The working solution is below:

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

and then adding to the Activity style:

<item name="android:actionBarTabStyle">@style/ActionBarTabStyle</item>

解决方案

From How to change the color of tab 'underbar' in actionbarsherlock, looks like the indicator is a part of a drawable. I haven't tried that but you probably can change @drawable/tab_selected and @drawable/tab_selected_focused to your own drawable. (Make it plain if you don't want the indicator.) Hope this helps.

Edit:

NOTE: HAVEN'T TESTED

You can try following the answer and change from tab_selected_focused to tab_unselected_focused and also from tab_selected to tab_unselected.

<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected" />
<item android:state_focused="false" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/tab_unselected" />

 <!-- Focused states -->
 <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused" />
 <item android:state_focused="true" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused" />

Edit 2: You can try ActionbarStyleGenerator to style the Actionbar.

"How to: Use the UI to select colors for different items Once done click on "DOWNLOAD .ZIP" The ZIP file contains resource files that you have to copy in your project res/layout and res/drawableXXXX folders"

这篇关于如何完全在动作条中删除选项卡指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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