特別な「HD」バージョンを配信せずにタブレットとスマートフォンをサポートしたいので、ユーザーのデバイスの解像度に応じて画像をスケーリングする必要があります。これは、Samsung Galaxy Nexus で見栄えのする ImageView ソースです。
<ImageView
android:id="@+id/character"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
android:src="@drawable/ma_un1_001" />
ただし、nexus 7 では画像がカットされます。
幅と高さを次のように変更したとき:
<ImageView
android:id="@+id/character"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
android:src="@drawable/ma_un1_001" />
残念ながら、これはビューから画像を縮小します:
xmlをに変更する
android:layout_width="wrap_content"
android:layout_height="fill_parent"
それでも画像をカットします。
そこで、scaleType を FIT_START に変更しました
<ImageView
android:id="@+id/character"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:background="@android:color/transparent"
android:scaleType="fitStart"
android:src="@drawable/ma_un1_001" />
すべてのデバイスで見栄えが良いのですが、ドローアブルが左に配置されています。中心にする方法はありますか?