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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:19:46+00:00 2026-06-14T13:19:46+00:00

This has been stumping me for a while, and I’m not sure how to

  • 0

This has been stumping me for a while, and I’m not sure how to fix it.

Supposing I have the following layout: 2 ImageViews with a TextView under each ImageView. The images are being retrieved remotely. I would like each ImageView to take about 40% of the width of the Activity they’re in, with white space under them. The TextViews will be about 5% smaller, centered below each ImageView.

What I tried:

Put each pair of ImageView and TextView in their own LinearLayout, so 2 LinearLayouts, with each LinearLayout’s layout_width set to fill_parent and equal layout_weight (0.5) for both.
Each ImageView had a layout_width of fill_parent and a layout_margin of 15dip. layout_height was set to wrap_content (this was the parameter I wasn’t sure how to set).

That worked fine but the problem was that all the incoming images were of different sizes and ratios, so they looked weird side by side.

I proceeded to set:
android:scaleType=”centerCrop”
android:adjustViewBounds=”true”

That helped but each ImageView was still different size sometimes. At this point, I just put each ImageView at a fixed width 100 dip or so
to both ImageViews, and that helped, but of course with bigger size devices this will look weird. How can I achieve what I’m trying to accomplish?

  • 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-14T13:19:47+00:00Added an answer on June 14, 2026 at 1:19 pm

    On the second option, try it without “AdjustViewBounds” remember:

    Set this to true if you want the ImageView to adjust its bounds to
    preserve the aspect ratio of its drawable.

    But here is what i would do in your case:

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.5"
        android:orientation="vertical" >
    
    
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:scaleType="center"
            android:src="@drawable/99" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|bottom"
            android:text="TextView" />
    </LinearLayout>
    
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.5"
        android:orientation="vertical" >
    
    
        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:scaleType="center"
            android:src="@drawable/ic_launcher" />
    
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="TextView" />
    </LinearLayout>
    

    And it will look like on larger screens:

    Test1

    And on smaller screens:

    test2

    I prefer center in this case, because if you have smaller pictures then they will look better. I try to avoid fixed sizes if you can, because as you said it won’t look good on larger devices.

    You can also make different layouts for each sceen size. But you will have to mantain all of them. Check Supporting Multiple Screen Sizes (if you haven’t already ;)).

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

Sidebar

Related Questions

This one has been stumping me for a while. But I'm no expert. This
This has been stumping me for a bit. I have a Class written in
This has been stumping me for a while. I am trying to create a
This has been destroying me for a while. I'm sure there's a reason for
This has been stumping me for a few days now. I have a stored
This has been frustrating me for a while now. I started developing a site
This has been a rather problematic issue on numerous occasions. We have alot of
This has been driving me crazy for the past few minutes I have a
This has been driving me nuts. I keep getting the following exception System.InvalidOperationException: The
This has been driving me nuts. I hope it's not been asked before but

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.