Android 加上「;重量“;插入芯片组以填充父级宽度的步骤

Android 加上「;重量“;插入芯片组以填充父级宽度的步骤,android,android-chips,Android,Android Chips,我在芯片组中有2个芯片。我需要它们填满整个屏幕,就像我们如何在线性布局中使用android:layou-weight一样 我试过这个: <com.google.android.material.chip.ChipGroup android:layout_width="match_parent" android:layout_height="wrap_content" app:singleSelection="true

我在
芯片组中有2个
芯片
。我需要它们填满整个屏幕,就像我们如何在
线性布局中使用
android:layou-weight
一样

我试过这个:

<com.google.android.material.chip.ChipGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:singleSelection="true"
    app:selectionRequired="true"
    >

        <com.google.android.material.chip.Chip
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="@dimen/pill_button_height"
            android:id="@+id/chip1"
            style="@style/Widget.MaterialComponents.Chip.Choice"
            app:shapeAppearanceOverlay="@style/Chip.LeftRounded"
            android:text="Left"
            />

        <com.google.android.material.chip.Chip
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="@dimen/pill_button_height"
            android:id="@+id/chip2"
            style="@style/Widget.MaterialComponents.Chip.Choice"
            app:shapeAppearanceOverlay="@style/Chip.RightRounded"
            android:text="Right"
            />

</com.google.android.material.chip.ChipGroup>

但是
layout\u-weight
不起作用,因为宽度是
0dp
,芯片就消失了。 如果有人知道如何解决这个问题,而不完全抛弃
芯片组
并创建我自己的实现,这将非常有帮助


谢谢。

A
芯片组
不会从任何其他视图组继承,因此如果没有自定义实现或以编程方式计算宽度,这似乎是不可能的。是的,我也倾向于认为这是不可能的。SighIt完全取消
芯片组
可能更容易,只需自己处理检查。我正是这么做的。使用
芯片
,但不使用
芯片组