2017-04-10 3 views
1

は私がそのレイアウトでTabLayout app:tabMode="scrollable"一元化TabLayoutは

マイTabLayout

<android.support.design.widget.TabLayout 
       android:id="@+id/tabLayout" 
       android:layout_width="match_parent" 
       android:layout_height="48dp" 
       android:layout_gravity="center" 
       android:background="@android:color/white" 
       android:gravity="center" 
       android:visibility="visible" 
       app:tabGravity="fill" 
       app:tabIndicatorHeight="0dp" 
       app:tabMaxWidth="0dp" 
       app:tabMode="scrollable" 
       app:tabSelectedTextColor="@color/colorTabSelected" 
       app:tabTextAppearance="@style/CustomTextStyle" 
       app:tabTextColor="@color/colorTabNormal"></android.support.design.widget.TabLayout> 

を集中管理します。この(ただし、すべてのタブが左整列されている)のようなTablayout:

enter image description here

app:tabMode="fixed"場合は、中央のタブ内のテキストは、他よりも小さいサイズを持っています。

enter image description here

So. app:tabMode="fixed"(すべてのタブが中央に揃えられている)の場合、TabLayoutのすべてのテキストと同じサイズにします。 app:tabMode="scrollable"の場合、tabMode fixedのようにタブを集中化したい ありがとう

答えて

0

私はまだTabLayoutへapp:tabMode="fixed"

app:tabMode="fixed" app:tabPaddingEnd="1dp" app:tabPaddingStart="1dp"

で、パディングを追加することで回避します。

1

SmartTabLayoutライブラリは常にタブの中央にタブを配置するのに役立ちます。

+0

以前は使っていましたが、TabLayoutのような簡単なものが欲しいです。アドバイスありがとう –

+0

問題ありません。 –

関連する問題