본문 바로가기
Android

Android constraint layout id 중복으로 사용하기

by kkong93 2024. 2. 27.
반응형

 

view를 visible, gone하면서 ui를 일정하게 유지하고 싶었다.

 

How to set constraint to two views?

<ConstraintLayout>

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/barrier"
        app:barrierDirection="left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:constraint_referenced_ids="view1,view2"/>    

    <TextView
        android:id="@+id/text_view"
        app:layout_constraintEnd_toStartOf="@id/barrier" />

    <View
        android:id="@+id/view1"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <View
        android:id="@+id/view2"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</ConstraintLayout>

 

 

https://stackoverflow.com/questions/50047796/how-to-set-constraint-to-two-views

 

How to set constraint to two views?

So I have a constraintLayout like this <ConstraintLayout> <TextView android:id="@+id/text_view" app:layout_constraintEnd_toStartOf="@+id/view1" /> <View android...

stackoverflow.com

 

반응형

댓글