안드로이드
14. 이미지로드와 Swipe 기능
본시모니
2023. 3. 8. 00:46
1. 이미지로드



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:srcCompat="@tools:sample/avatars" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>








<오류>
imagebutton을 넣었는데 오류가 났다...!!!

<해결>
activity_main.xml 파일의 Source탭에서
ImageButton 태그안에 아래 코드 추가하면 해결된다!!!
tools:ignore="SpeakableTextPresentCheck"



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="match_parent"
android:layout_height="100dp"
app:srcCompat="@drawable/left_button"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
tools:ignore="SpeakableTextPresentCheck" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="345dp"
android:layout_weight="1"
tools:srcCompat="@tools:sample/avatars" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="match_parent"
android:layout_height="100dp"
app:srcCompat="@drawable/right_button"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>




2. Swipe 기능
swipe = touch + move
