J'ai une application Android qui tire dans les images du Web. Cependant quand je mis:Android - redimensionner l'image dans la galerie basée sur la résolution de l'appareil
<supports-screens android:anyDensity="true" />
la galerie semble être réglé sur la résolution minimale prise en charge.
Voici la définition de mise en page de la galerie:
<?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>
et la classe 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);
est-il un moyen de détecter la résolution utilisée et redimensionner les images dans la galerie afin qu'ils étendent à la largeur de l'écran?