티스토리 뷰
ImageView의 높이를 가변적인 높이에 맞추고 싶을 때
Dexx 2016. 3. 31. 03:29부모뷰의 높이가 내용에 따라 가변적으로 변하는 warp-content 일 때
ImageView의 높이가 부모뷰 또는 가변적인 높이에 맞추고 싶을 때가 있다.
이럴 때
1 2 3 4 5 6 7 8 9 | <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" //이미지가 표현하고자 하는 레이아웃보다 클때 비율 유지 android:adjustViewBounds="true" android:scaleType="centerCrop" android:src="@drawable/test2" android:layout_alignTop="@id/contentBox" android:layout_alignBottom="@id/contentBox"/> | cs |
원하는 높이를 가지는 뷰에 alignTop과 alignBottom을 맞추면 자동으로 조절 된다.
'Android 개발 메모' 카테고리의 다른 글
커스텀 프로그래스바 만들기 (0) | 2016.05.20 |
---|---|
배열리소스(string-array)를 활용한 GridView (0) | 2016.03.24 |
Floating Labels 관련 잘 정리 내용 (0) | 2016.03.17 |