안드로이드 -ImageView
○ src
- 출력한 이미지를 지정하는 가장 중요한 속성. 이 속성에 값을 대입하지 않으면 아무것도 보이지 않으므로 반드시 지정해야 한다.
ex) android:src="@drawble/파일명"
android:src="@drawble/pride"
○ maxHeight, maxWidth
- 이미지가 출력될 최대 크기를 지정한다. 별다른 지정이 없으면 이미지의 원래 크기대로 출력되지만 모바일 장비의 해상도가 충분치 않으므로 적당히 제한할 필요가 있다.
ex) android:maxHeight="크기", android:maxWidth="크기"
android:maxHeight="70px", android:maxWidth="120px"
○ adjustViewBounds
- 이미지의 종횡비를 맞추기 위해 이미지 뷰의 크기를 적당히 조정할 것인가를 지정한다. true or false 둘중 하나의 값만 지정가능하므로 하나만 사용해야 한다.
ex) android:adjustViewBounds="true", android:adjustViewBounds="false"
○ cropToPadding
- true일 경우 위젯의 주어진 여백에 맞추기 위해 이미지의 일부를 잘라낸다. 이 속성을 사용하면 여백을 강제로 유지하므로 이미지 전체가 다 보이지 않을 수도 있다.
○ tint
- 이미지에 색조를 입힌다. 색상이 이미지 위에 살짝 덮혀 출력된다. 통상 반투명한 색상을 지정하여 이미지 위에 옅은 색상을 뿌리는 효과를 낸다.
ex) android:tint="#80ff000"
○ scaleType
- 이미지의 원래 크기와 다르게 출력 할 때 적용할 확대, 축소 방식을 지정한다. matrix, fitXY, center, centerCrop, centerInside 등의 여러 가지 방법 중 하나를 지정한다.
예제)
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/pride"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/pride"
android:maxHeight="70px"
android:maxWidth="120px"
android:adjustViewBounds="true"
/>
<ImageVIew
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/dog"
android:tint="#80ff0000"
/>