【Android】解决TabLayout在宽屏幕上tab不能平均分配的问题

解决TabLayout在宽屏幕上tab不能平均分配的问题

当TabLayout 在宽屏幕的设备上,如平板横屏的时候,tab的宽度超过一定值后,就不在平均分配宽度,而是居中显示。此时设置

app:tabMode="fixed"或者top_table.setTabMode(TabLayout.MODE_FIXED);不在起作用。此时的解决办法,设置

app:tabMaxWidth="0dp" 

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

猜你喜欢

转载自blog.csdn.net/weixin_42473228/article/details/134854503
今日推荐