如何使制表符采用全角? [com.google.android.material.tabs.TabLayout]

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

还有其他问题,但所有人都回答了如何在XML标签中充分运用智慧:]

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

并且答案(以上)在我项目的XML标签中不起作用:

<com.google.android.material.tabs.TabLayout/>

我使用ConstraintLayout作为根:

<androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

应该有可能,但似乎找不到答案。那么如何用固定数量的Tabs填充根宽度?

android material-design android-tablayout
1个回答
0
投票

显然,它是如此简单。关键是使用:android:layout_width="0dp"代替app:tabMaxWidth="0dp",并带有app:tabGravityapp:tabMode

这里是完整标签:

<com.google.android.material.tabs.TabLayout
      android:layout_height="wrap_content"
      android:layout_width="0dp"
      app:tabGravity="fill"
      app:tabMode="fixed"/>
© www.soinside.com 2019 - 2024. All rights reserved.