Androidスタジオのグリッドビューに画像をフィットする際に問題があります。基本的には、1行につき2枚の画像を必要とし、画像上でTextViewsで下にスクロールすることができますが、上下にスクロールして画像を重ね合わせると位置が変わります。彼らは元の形式で異なる次元を持っています。Android Gridview、画像が一致しない
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/photo"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_margin="2dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:textSize="10dp"
android:id="@+id/hoverText"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="64dp"
android:id="@+id/hoverId"/>
</RelativeLayout>
GridViewのレイアウトactivity_district.xml:あなたの助けを
おかげ はここに私の画像レイアウトitem_district.xmlです!
xmlでscaleTypeを変更します。android:scaleType = "fitXy" –