2016-12-29 467 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