Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4581304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:54:25+00:00 2026-05-21T20:54:25+00:00

I have a Gallery with images that are at the same size.. When in

  • 0

I have a Gallery with images that are at the same size..
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..
Here is the ImageAdapter I use:

public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
int counter =0 ;

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;
     }
      }

The xml:

    <ScrollView 
android:id="@+id/QuranGalleryScrollView" 
android:layout_height="fill_parent" 
android:layout_width="fill_parent">
<Gallery android:id="@+id/GalleryLandscape" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
</Gallery>
    </ScrollView>

How is it possible to make the imageviews inside the Gallery stretch to fit the screen?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:54:26+00:00Added an answer on May 21, 2026 at 8:54 pm

    In your getView() method add this line:

    i.setLayoutParams( new Gallery.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT));
    

    This is what worked for me before, give it a try!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIScrollView that houses a gallery of images the user can scroll
I have a PHP photo gallery that reads the GPS coordinates from images. I'd
I have gallery.php that loads images with src path from a database. I also
I have an image gallery that I created by reading the contents inside a
I my working on the site that will have image gallery. Designer idea was
Does anyone have a suggestions for a superb cool image gallery that I can
I have photo gallery code that does image re-sizing and thumbnail creation. I use
I have a PHP script that initialises an image gallery. It loops through all
I'd like to make a gallery of all images i have under my domain
I have been creating an image gallery with jQuery, all is done. The images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.