ConstraintLayoutに鎖を含むビューのグループを合わせます垂直鎖、およびはチェーンに対して中心に配置されています。しかし、グループ全体を親の中心に揃えるにはどうすればいいですか? のCは、GONE
であることに注意してください。私はConstraintLayoutで3つのビューがあり、このように、その後整列する
<android.support.constraint.ConstraintLayout
android:id="@+id/outerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:id="@+id/innerLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
[A, B, and C views here...]
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
外側のレイアウトができます。
ビューCが 'GONE'の場合は、BとCを' LinearLayout'でラップし、残りのレイアウトを制約で行うのが最も簡単だと思います。これは、BがCよりも広い潜在的な問題も解決するだろう。 – Suragch