従属ビューの可視性がGONEに設定されている場合のTextViewのベースライン制約を再調整する方法はありますか?私は私のレイアウトは次のようになりますGONE
するsubtitle2
のTextViewの可視性を設定していた場合 ConstraintLayout:従属ビューの可視性がGONEに設定されている場合のベースライン制約の再調整
マイレイアウトコード:この場合、
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TITLE"
android:textColor="@color/black"
android:textSize="24sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/subtitle1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SUBTITLE 1"
android:textSize="11sp"
app:layout_constraintBaseline_toBaselineOf="@+id/subtitle2"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/subtitleSpace"
app:layout_constraintRight_toRightOf="parent"/>
<android.support.v4.widget.Space
android:id="@+id/subtitleSpace"
android:layout_width="12dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@+id/subtitle1"
app:layout_constraintRight_toLeftOf="@+id/subtitle2"/>
<TextView
android:id="@+id/subtitle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="SUBTITLE 2"
android:textSize="14sp"
app:layout_constraintLeft_toRightOf="@+id/subtitleSpace"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"/>
</android.support.constraint.ConstraintLayout>
、私のレイアウトは次のようになります
私は、依存関係がある場合にベースラインを再調整できるいくつかの制約があるかどうか疑問に思っていますewがありません。
ありがとう!私は既にあなたが提案したのと同じ解決策を適用しましたが、 'GONE'テキストビューベースラインにいくつかの制約があるかどうか疑問視していました。私は実際にレイアウトに空のビューを残して、複雑さを避け、よりきれいに保つことを望んでいません。 – novachevskyi
私はその質問に対する答えはないと思っていますが、そんなことをするのは理にかなっています。 – Cheticamp