我在我的 FragmentActivity
(最小 SDK = 14)中使用了一个 ActionBar
,我需要删除 Activity 的 Tab 指示器(见下图),因为我有自己的图标用于指示哪个选项卡处于 Activity 状态。我一直在阅读很多与样式相关的东西,但是没有找到解决方案。有什么建议可以完全删除这个指标吗?
已解决
工作解决方案如下:
<style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">@android:color/transparent</item>
</style>
然后添加到 Activity 样式中:
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle</item>
最佳答案
来自 How to change the color of tab 'underbar' in actionbarsherlock , 看起来指示器是可绘制对象的一部分。我没试过,但你可能可以将 @drawable/tab_selected 和 @drawable/tab_selected_focused 更改为你自己的 drawable。 (如果您不想要指示器,请说清楚。)希望这对您有所帮助。
编辑:
注意:尚未测试
您可以尝试关注 the answer并从 tab_selected_focused 更改为 tab_unselected_focused,也从 tab_selected 更改为 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" />
编辑 2: 您可以尝试 ActionbarStyleGenerator 来设置 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"
关于android - 如何完全删除 ActionBar 中的选项卡指示器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384727/