이미지뷰는 이미지를 이용하기위한 위젯입니다.
이미지파일을 drawable 에 저장하여 사용합니다.
1. UI code
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image" />
2. JAVA code
ImageView imageview;
imageview = findViewById(R.id.imageView);
imageview.setImageResource("내가 설정하고 싶은 이미지");
이미지뷰에 이미지뷰위젯 아이디를 저장하고 setImageResource 함수에 내가 원하는 이미지를 담아 변경할 수 있습니다.
'개발 > 안드로이드' 카테고리의 다른 글
Android - AlertDialog (0) | 2023.01.30 |
---|---|
Android - LinearLayout (0) | 2023.01.30 |
Android - Log (0) | 2023.01.30 |
Android - Toast / snackbar (0) | 2023.01.30 |
Android - EditText (0) | 2023.01.30 |