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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:26:10+00:00 2026-05-18T00:26:10+00:00

I have a TableLayout with 3 TableRows, each TableRow has 3 ImageViews. Each ImageView

  • 0

I have a TableLayout with 3 TableRows, each TableRow has 3 ImageViews. Each ImageView has fitCenter for Scale type, and a weight and width per this stackoverflow answer. Now all the images scale to fit into the row, but each row is way taller then it needs to be. Here’s an excerpt of the xml:

<TableLayout android:id="@+id/TableLayout01"
android:layout_height="wrap_content"
android:padding="10dip"
android:stretchColumns="0,1,2"
android:shrinkColumns="0,1,2"
android:layout_weight="1"
android:layout_width="wrap_content">
    <TableRow android:id="@+id/TableRow01"
    android:layout_width="fill_parent"
    android:layout_gravity="center_vertical|center_horizontal"
    android:baselineAligned="false"
    android:gravity="center_vertical|center_horizontal"
    android:layout_height="wrap_content">
        <ImageView android:id="@+id/image1"
        android:src="@drawable/avocado3"
        android:scaleType="fitCenter"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="wrap_content"/>
        <ImageView android:id="@+id/image2"
        android:src="@drawable/avocado3"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:scaleType="fitCenter"/>
        <ImageView android:id="@+id/image3"
        android:src="@drawable/avocado3"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:scaleType="fitCenter"/>
    </TableRow>
...
</TableLayout>

And here’s the first row:

first row

And the end of the first row and start of the second:

second row

The ImageViews are set to a drawable that is small (@drawable/avocado3), and in the activity’s onCreate() it fetches 9 images from the internet and calls setImageBitmap().

Anyone have any ideas on what I’m doing wrong?

  • 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-18T00:26:11+00:00Added an answer on May 18, 2026 at 12:26 am

    By default, scaleType only changes the size of the actual image, but not the size of the surrounding ImageView. Since the height of the ImageView is set to wrap_content, it will take all the space it needs to display the full image, and then scale the image to fit it inside it’s width.

    Try setting adjustViewBounds to true. If that doesn’t help, try setting a fixed layout_height or play around with the maxHeight property.

    It might also help to take a look inside the hierarchy viewer: http://developer.android.com/guide/developing/tools/hierarchy-viewer.html.

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

Sidebar

Related Questions

I'm using a TableLayout in Android. Right now I have one TableRow with two
i have created following layout. <TableLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal > <TableRow> <TextView android:layout_width=fill_parent android:layout_height=wrap_content
I have four buttons arranged in a 2x2 TableLayout. These buttons each have an
I have a TableLayout with a tableRow and a horizontal scroll view in the
My layout looks like: <TableLayout> <TableRow></TableRow> <TableLayout> <TableRow></TableRow> <TableRow></TableRow> <TableRow></TableRow> </TableLayout> </TableLayout> I have
To simulate a grid, I have a tablelayout with background #ffffff , tablerow with
I have a TableLayout in the xml that has a row. I am adding
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have a working dynamic TableLayout that holds user data. Clicking an Add Event
I have an EditText and a Button set next to each other on the

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.