Android TabBar Style未缩放至全屏

时间:2015-07-17 17:44:59

标签: android android-layout android-tabs android-styles android-tablelayout

这是我当前的TabBar Style

  <style name="SM5Theme" parent="android:style/Theme.Holo.Light">
    <item name="android:actionBarTabStyle">@style/SM5Theme.ActionBarTabStyle</item>
    <item name="android:actionBarTabBarStyle">@style/SM5Theme.ActionBarTabBarStyle</item>
    <item name="android:actionBarTabTextStyle">@style/SM5Theme.ActionBarTabTextStyle</item>
  </style>

  <style name="SM5Theme.ActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/tab_bar_background</item>
    <item name="android:gravity">center</item>
    <item name="android:dividerPadding">0dp</item>
    <item name="android:showDividers">middle</item>
    <item name="android:textColor">@color/tab_highlight</item>
  </style>

  <style name="SM5Theme.ActionBarTabTextStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabBar">
    <item name="android:textColor">@color/tab_textcolor</item>
  </style>

  <style name="SM5Theme.ActionBarTabBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabView">
  </style>

TabBarBackground:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_bar_background_non_selected"/>
  <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_bar_background_selected"/>
  <item android:state_selected="false" android:state_pressed="true" android:drawable="@color/tab_highlight"/>
  <item android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_bar_background_selected_pressed"/>
</selector>

tab_bar_background_selected:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:top="-3dp" android:left="-3dp" android:right="-3dp">
    <shape android:shape="rectangle">
      <stroke android:color="@color/tab_bottom_bar" android:width="3dp"/>
      <solid android:color="@color/tab_background_selected"/>
    </shape>
  </item>
</layer-list>

这在生成Tab主题和下划线颜色方面令人满意。然而,问题在于它并没有一直扩展。

enter image description here

我该如何解决这个问题?我不想使用sherlock或android主题生成器。

0 个答案:

没有答案