Strech ImageViews in the Gallery to fit screen
<p>I have a Gallery with images that are at the same size..<br>
When in Portrait, the images take the whole screen and it works well, though in Landscape, the images arent stretching to the whole screen and parts of other images are displayed also in the same screen..<br>
Here is the ImageAdapter I use:</p>

<p>public class ImageAdapter extends BaseAdapter {
    int mGalleryItemBackground;
    int counter =0 ;</p>

<pre><code>private Context mContext;

public String[] mImageIds;

public ImageAdapter(Context c) {
    mContext = c;
    TypedArray a = c.obtainStyledAttributes(R.styleable.Gallery1);
    mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0);
    a.recycle();
}

public void insert(String string)
{
    mImageIds[counter]=string;
    counter++;
}

public int getCount() {
    return mImageIds.length;
}

public Object getItem(int position) {
    return position;
}

public long getItemId(int position) {
    return position;
}

public View getView(int position, View convertView, ViewGroup parent) {
    ImageView i = new ImageView(mContext);

    i.setImageBitmap(BitmapFactory.decodeFile(mImageIds[position]));

    i.setScaleType(ImageView.ScaleType.FIT_XY);
    i.setBackgroundResource(mGalleryItemBackground);

    return i;
     }
      }
</code></pre>

<p>The xml: </p>

<pre><code>    &lt;ScrollView 
android:id="@+id/QuranGalleryScrollView" 
android:layout_height="fill_parent" 
android:layout_width="fill_parent"&gt;
&lt;Gallery android:id="@+id/GalleryLandscape" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"&gt;
&lt;/Gallery&gt;
    &lt;/ScrollView&gt;
</code></pre>

<p>How is it possible to make the imageviews inside the Gallery stretch to fit the screen?
Thanks</p>
