xmlでimageviewを使用しており、res/drawable-xhdpiからそれに画像を設定しています。私の画像のサイズは354x404で、10インチのサムスンタブレットでコードを実行すると、画像が177x202と表示されます。
これが私が使用しているコードです:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false" >
<ImageView
android:id="@+id/img_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@drawable/android1" />
</LinearLayout>
これが私が使用している画像です:
そして、これはタブレットのスクリーンショットです:
それが起こっている理由と、この問題を解決するための解決策を教えてください。
更新:この画像をxhdpiではなく「res / drawable」フォルダーに配置すると、画像が正しく表示されます(つまり、354x404)。