공부방/Android

ConstraintLayout include bug of app name space(ConstraintLayout app 네임 스페이스 버그)

soycrab 2020. 2. 9. 17:59
<include layout="@layout/view_item_list" />

우리가 일반적으로 중복해서 레이아웃을 사용할때 

include 를 통해 뷰를 재사용한다. 

하지만 ConstaConstraintLayout 안에서 

위처럼 선언하고 

app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

이런식으로 선언하면 작동을 하지않는다.

이럴때는 

 

뷰의 넓이와 높이를 재설정 해주어야 정상 동작한다. 

 

 <include layout="@layout/view_item_list"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        app:layout_constraintTop_toTopOf="parent"
		app:layout_constraintBottom_toBottomOf="parent"/>
반응형