개발 창고/Android
[Android] ImageView 이미지 크기에 View 크기 맞추는 법
로이제로
2020. 10. 28. 23:15
반응형
가끔 이미지를 ImageView로 보여주려는 경우 이미지 사이즈에 맞게 사이즈가 조절이 되지 않는 경우가 있을 겁니다.
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff0000"
android:src="@drawable/scr01_01" />
※ 확실한 구분을 보여주기 위해 레이아웃 배경을 빨강(android:background="#ff0000")으로 설정해주었습니다.
이때 아래와 같이
android:adjustViewBounds="true"
를 추가해주면 다음과 같이 적용됨을 확인하실 수 있습니다.
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff0000"
android:adjustViewBounds="true"
android:src="@drawable/scr01_01" />
반응형