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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:56:59+00:00 2026-06-05T21:56:59+00:00

I need a GridView, but in each grid, there will be an ImageView and

  • 0

I need a GridView, but in each grid, there will be an ImageView and TextView over/inside it.

It will be like an item image in each grid, and name of the item on the image.

I am tring:

    public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) { // if it's not recycled, initialize some
                                // attributes
        imageView = new ImageView(mContext);
        imageView.setLayoutParams(new GridView.LayoutParams(300, 300));
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setPadding(0, 0, 0, 0);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mThumbIds[position]);

    TextView nameView = new TextView(mContext);
    nameView.setText("Name");
    nameView.setTextSize(20);

    parent.addView(nameView);

    return imageView;
}

in my grid view adapter. But I cannot add it here. Also I tried to add it in ImageView but since it is not a ViewGroup, I couldn’t achieve.

UPDATE:

public View getView(int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = LayoutInflater.from(mContext);
    ViewHolder holder;

    if (convertView == null) { // if it's not recycled, initialize some
                                // attributes
        convertView = inflater.inflate(R.layout.gridviewitem, null, true);
        holder = new ViewHolder();
        holder.image = (ImageView) convertView
                .findViewById(R.id.gridViewItemImage);
        holder.name = (TextView) convertView
                .findViewById(R.id.gridViewItemName);
        holder.price = (TextView) convertView
                .findViewById(R.id.gridViewItemPrice);
        convertView.setTag(holder);

    } else {    
        holder = (ViewHolder) convertView.getTag();
    }

    holder.image.setImageResource(mThumbIds[position]);
    holder.name.setText("Item " + String.valueOf(position));
    holder.price.setText("$15");

    return convertView;
}

This solved my problem

  • 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-05T21:57:01+00:00Added an answer on June 5, 2026 at 9:57 pm

    Create a RelativeLayout that contains the ImageView and the TextView,with TextView’s bottom edge aligned with the Imageview's bottom edge.

    <RelativeLayout ...>
        <ImageView ...>
        <TextView ...
          android:layout_alignBottom="id of the imageview"> // or to top
    </RelativeLayout>
    

    Inflate this layout in getView method of your adapter.

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

Sidebar

Related Questions

i have GridView with each Grid as a simple TextView. i need a scrollbar
i need to have a gridview of linearlayouts. Each linearLayout must have a imageview
Why is there a need to explicitly call GridView.DataBind() to render the gridview. Why
Need some help to solve this. I have a gridview and inside the gridview
What are the advantages of using listview over gridview? I need pagination, editing rows,
The situation is, that i need to create table in grid view looking like
I binded my column (Status) to value. But I need to show image for
I'm getting data from DB and displayed in a GridView fine. But I need
I have a GridView with four columns, on each item I added my library
I need to have a GridView listing all invoices of an account. Each account

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.