I have an Android app that retrieves images from the Internet. However, when I install:
<supports-screens android:anyDensity="true" />
the gallery has the minimum supported resolution.
Here is the gallery layout definition:
<?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>
and getView class:
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);
Is there a way to determine the resolution used, and then resize the images in the gallery so that they stretch to the width of the screen?
source share