업무

constraintHeight_percent와 RecyclerView스크롤 이슈

show2888 2023. 11. 30. 17:29
반응형

문제상황)

위 아래로 2개의 ConstraintLayout를 적용한뷰가 1:1의 비율을 유지하기 위해  app:layout_constraintHeight_percent = 0.5를 적용한 상태에서 ConstraintLayout안에있는 RecyclerView의 스크롤이 정상적으로 동작하지 않았다.(처음 스크롤시 버벅거림)

 

원인)

constraint전체에 app:layout_constraintHeight_percent를 적용하고 그안에 리사이클러뷰를 사용하면

스크롤이 중복으로 불리는 이슈가 있다.

 

해결)

layout_constraintHeight_percent를 제거하고 다음과 같이 GuildeLine을 사용해 해결 

app:layout_constraintGuide_percent="0.5"

 

반응형