android tablayout 宽度不平均

当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" />
---------------------
作者:小蜗牛在漫步
原文:https://blog.csdn.net/chenli_001/article/details/72844139

发布了14 篇原创文章 · 获赞 23 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_27378951/article/details/86012687