ing*_*abh 1 tabs android actionbarsherlock
在删除操作栏选项卡之间的分隔符和填充时,我会遇到问题.我使用这个生成样式,以下是我的值-14条目,我在4以上的版本上测试
<style name="Theme.Example" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionBarItemBackground">@drawable/selectable_background_example</item>
<item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
<item name="android:dropDownListViewStyle">@style/DropDownListView.Example</item>
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Example</item>
<item name="android:actionDropDownStyle">@style/DropDownNav.Example</item>
<item name="android:actionBarStyle">@style/ActionBar.Solid.Example</item>
<item name="android:actionModeBackground">@drawable/cab_background_top_example</item>
<item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_example</item>
<item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">@style/Theme.Example.Widget</item>
</style>
// It seems below code has no effect
<style name="ActionBarTabStyle.Example" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:showDividers">none</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:minWidth">0dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)
为了便于说明,这里的内容与我想要的完全相同,即选项卡和操作栏之间没有线条,几乎是0填充

从api 21不推荐使用ActionBar选项卡.我建议您使用以下方法之一使用工具栏.
截图显示我认为这是使用工具栏和其中一个实现的
PagerSlidingTabStrip或SlidingTabsBasic.例如,您可以看到Android PagerSlidingTabStrip(默认材质设计)的示例,以了解如何准确实现您想要的内容.
按照下面的例子.
对您有所帮助
更新...
您可以更改与标签bg颜色相同的标签分隔线颜色.所以这种效果就像你没有任何分隔.
<item name="android:actionBarDivider">@color/background</item>
Run Code Online (Sandbox Code Playgroud)
我希望它适合你.
更新 - 2这是关于如何从我今天找到的旧代码自定义设计选项卡视图
在android清单中添加 -
android:theme="@style/MyTheme"
Run Code Online (Sandbox Code Playgroud)
在style.xml中为tabview创建新样式
<style name="MyTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarTabStyle">@style/MyTheme.ActionBar.TabView</item>
</style>
<style name="MyTheme.ActionBar.TabView" parent="android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">@drawable/new_tab_bar</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在Drawable中创建这样的新标签栏
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- UNSELECTED TAB STATE -->
<item android:state_selected="false" android:state_pressed="false">
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/transparent"/>
</shape>
</item>
<!-- Bottom indicator color for the UNSELECTED tab state -->
<item android:top="-5dp" android:left="-5dp" android:right="-5dp">
<shape android:shape="rectangle">
<stroke android:color="#65acee" android:width="0dp"/>
</shape>
</item>
</layer-list>
</item>
<!-- SELECTED TAB STATE -->
<item android:state_selected="true" android:state_pressed="false">
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Tab background color for the SELECTED tab state -->
<item>
<shape>
<solid android:color="#0099CC"/>
</shape>
</item>
<!-- Bottom indicator color for the SELECTED tab state -->
<item android:top="-5dp" android:left="-5dp" android:right="-5dp">
<shape android:shape="rectangle">
<stroke android:color="@color/tab_select_backgroung" android:width="0dp"/>
</shape>
</item>
</layer-list>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
在此new_tab_bar中添加更改并在操作栏选项卡中获取您想要的更改.
| 归档时间: |
|
| 查看次数: |
4485 次 |
| 最近记录: |