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 6080109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:01:27+00:00 2026-05-23T11:01:27+00:00

Hey, I have a Gallery in a ScrollView, the problem is that when in

  • 0

Hey, I have a Gallery in a ScrollView, the problem is that when in Landscape, the images are not scaled to fill the screen, Here is a screenshot: picture (ignore the toast)
As you can see the image in the middle is the one that is currently selected, but you can see that in the left/right sides of the screen parts of the next/previous images are also displayed.. how can I make the image in the middle get scaled to the whole screen?
ImageAdapter class:

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

xml:

  </Gallery>
    <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>

Thanks.

Edit1:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:id="@+id/relative">


    <Gallery android:id="@+id/Gallery" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">
    </Gallery>
    <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>
 <....other relative views here....>
</RelativeLayout>

{I’m also using other Relative views so they get displayed above the gallery, though this is at the top of xml..

  • 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-23T11:01:27+00:00Added an answer on May 23, 2026 at 11:01 am

    The only way I was able to fix this was to add the following in the getView method of my code.

    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    i.setLayoutParams(layoutParams);

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

Sidebar

Related Questions

Hey, I have Pictures that are bigger than the screen in a gallery, so
Hey i have this div that shows as a popup: <div class=popup> </div> Then
Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
Hey I have a problem comparing the value of a CGPoint (struct with two
Hey I have a really annoying IE7 bug that I am trying to work
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class
hey i have displayed a pop-up screen when i click on a menu item
Hey all, I have a list of 4 thumbnail images. When one of these
hey i have a counter text here and i need to know how to
Hey I have a problem getting my head around how custom GWT event Handlers

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.