1
海蘭,約束佈局隱藏查看與鏈重量
我想有2次平均分佈在屏幕的寬度在ConstraintLayout。 用鏈條和重量來實現。
<Button
android:id="@+id/buttonLeft"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:text="Left"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="@+id/guidelineLeft"
app:layout_constraintRight_toLeftOf="@+id/buttonRight"
tools:layout_editor_absoluteY="0dp"/>
<Button
android:id="@+id/buttonRight"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="0dp"
android:text="Right"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@+id/buttonLeft"
app:layout_constraintRight_toLeftOf="@+id/guidelineRight"
tools:layout_editor_absoluteY="0dp"/>
現在我想隱藏右邊的視圖和左邊的增長來填充寬度。
我想這可能因爲visiblity behaviour
開箱的,但作爲左按鈕的右邊都有一個約束,它不會增長。
任何想法如何解決?
感謝您的快速回答。但如果我使用您提出的佈局,左側視圖不會在右側隱藏時增長。至少佈局編輯器不顯示它。看到[這裏](https://imgur.com/a/TpKD4) – cwiesner
現在可以使用1.0.1中包含的bug修復 - thx – cwiesner