2016-12-29 109 views

回答

0

你可以改变颜色tabIndicator和高度像下面

<android.support.design.widget.TabLayout 
android:id="@id/pages_tabs" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
app:tabIndicatorColor="@android:color/white" 
app:tabIndicatorHeight="4dp"/> 

据我所知,你的标签指示长度设置为它的标签宽度,你不能改变的唯一指标尺寸 如果你真的想改变尝试改变tabWidth所以指标也随着这种变化而变化。

app:tabMaxWidth="30dp" 
+0

你是对的。通过更改tabWidth来设置标签指示符长度是可行的,但UI不够美​​观。非常感谢你 – Vathe

+0

请接受答案,如果它帮助你:) – Jayanth

+0

我想得到更好的A.如果不是,我会接受你的答案。谢谢 – Vathe

-2

您可以添加在标签布局另一个布局,并相应地给予填充。

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="20dp" 
     android:paddingRight="20dp" 
     android:layout_below="@+id/toolbar" 
     android:id="@+id/tabLayout" 
     android:background="@color/colorTangerine"> 

    <com.techlabs.oodhaar.views.CustomTabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabBackground="@color/colorTangerine" 
     app:tabIndicatorColor="@color/colorBackground" 
     app:tabSelectedTextColor="@color/colorBackground" 
     app:tabTextColor="@color/colorBackground" 
     app:tabIndicatorHeight="4dp" 
     /> 
    </RelativeLayout> 
+0

你看过这个问题吗? –

0
app:tabMinWidth="210dp" 
app:tabMaxWidth="110dp" 

添加只是这两行代码在你的XML。它取决于你的标签项目。你可以修改一次只增加和减少。

Check this picture