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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:23:51+00:00 2026-06-15T23:23:51+00:00

I am having a gridView with each item having an image to be loaded.

  • 0

I am having a gridView with each item having an image to be loaded. I have used adapter to render the image. I am assigning images as gridView items using resource ID array created using images in drawable folder.

The problem is gridView is being displayed with only 12 images(which fits the view without scrolling). I have around 40 images resource ID in that array. the getView is called only 12-13 times.

Could you pleae help me how to display all 40 images on grid view? Do i need to explicitly add scrollpane in grid.xml?

Below is the grid.xml layout

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" 
        android:background="@drawable/wooden_background"
         android:id="@+id/RootView">
         <GridView
            android:id="@+id/gridView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:numColumns="3"
            android:stretchMode="columnWidth"
            android:padding="5dp"
            android:verticalSpacing="5dp"
            android:horizontalSpacing="5dp"
            android:gravity="center"
            android:maxWidth="150dip"
            android:maxHeight="150dip" >

        </GridView>

    </LinearLayout>

Below is the getView function inside adapter

    public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    View vi;
    if (convertView == null){  // if it's not recycled, initialize some attributes
        vi = inflater.inflate(R.layout.each_image,parent, false);
    }
    else{
        vi=convertView;
    }
        /*imageView = new ImageView(mContext);
        imageView.setLayoutParams(new GridView.LayoutParams(170,170));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);*/

    System.out.println("Inside getView");
    ImageView image = (ImageView)vi.findViewById(R.id.imageView);
    image.setMaxHeight(150);
    image.setMinimumHeight(150);
    image.setScaleType(ImageView.ScaleType.FIT_XY );
    image.setImageResource(imageIngredientsID[position]);

    return vi;
}
  • 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-06-15T23:23:52+00:00Added an answer on June 15, 2026 at 11:23 pm

    How many items the gridview gets depends entirely on your getCount() method in your adapter, what does it return? 12?

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

Sidebar

Related Questions

i am using devexpress gridview 9.2. i have 2 gridview having 2 colum -->
I am having weird scrolling issues in my pretty simple GridView. Each item in
I'm having trouble creating a Gridview that can span 2 rows for each record.
I am using C# and .NET 3.5 and have a GridView that I am
I have a gridview having text boxes in template fields and buttons in footer,
Hi i have a gridview contains hundred of records, it is having paging, every
I have a GridView that is customized by each page that uses it. The
I have a gridview with several rows. Each row has value for each column.
I have a Gridview which is having 2 columns : plan value and actual
I having the page in that i have the gridview and page index changing

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.