选项卡图标未填满宽度

问题描述 投票:1回答:2

我尝试了几种解决方案,但没有任何效果。在某些设备上,标签栏无法填充父级的宽度。它在Samsung Tab 2等设备上运行良好,而在象素2等设备上则无法运行(就像附加的图像一样)。

strong text

<android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabTextAppearance="@style/MyTabLayoutTextAppearance"
        app:layout_constraintBottom_toBottomOf="parent"
        app:tabIndicatorColor="@color/colorBackground"
        app:tabMode="scrollable"
        app:tabMaxWidth="0dp"
        app:tabGravity="fill"
        app:tabSelectedTextColor="@color/colorPrimary"
        />

`

android android-support-library android-tablayout material-components-android android-support-design
2个回答
1
投票

1
投票
enter image description here

还要检查doc:在

支持设计库:中

重力尽可能多地填充TabLayout。与MODE_FIXED一起使用时,此选项仅生效

生效。
使用Material Components Library

重力尽可能多地填充TabLayout。在小于MODE_FIXED宽的非横向屏幕上与600dp一起使用时,此选项

仅生效

效果。

© www.soinside.com 2019 - 2024. All rights reserved.