3
私は、Webから画像を取り込むAndroidアプリを持っています。 は、しかし、私は設定した場合:Android - デバイスの解像度に基づいてギャラリーの画像のサイズを変更する
<supports-screens android:anyDensity="true" />
ギャラリーがサポートされている最小解像度に設定されているようです。ここで
はギャラリーレイアウト定義である:
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout android:id="@+id/GalleryLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#000000"
>
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:spacing="1dip"
android:gravity="center_vertical|center_horizontal|center"
/>
</LinearLayout>
とgetViewメソッドクラス:
ImageView i = new ImageView(mContext);
i.setImageDrawable(drawablesFromUrl[position]);
i.setLayoutParams(new Gallery.LayoutParams(400, 300));
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(mGalleryItemBackground);
が使用解像度を検出し、その後、彼らはストレッチので、ギャラリーに画像のサイズを変更する方法はあります画面の幅に?