LoginSignup
18
14

More than 5 years have passed since last update.

Support design libraryのTabLayoutをタブレットで使用するときの注意点

Last updated at Posted at 2015-08-19

AndroidのSupport design libraryで登場したTabLayoutをTabletで使用するとき下記のようなコードで普通に実装すると文字サイズに合わせてタブが表示され左右に大きなマージンができてしまう。

<android.support.design.widget.TabLayout
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"/>

下記のように書くとマージンが消えてタブが画面幅に合うようになる。

<android.support.design.widget.TabLayout
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:tabMaxWidth="0dp"
    app:tabGravity="fill"
    app:tabMode="fixed" />

すごくめんどくさい。。。

18
14
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
14