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

  • Home
  • SEARCH
  • 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 8236177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:03:55+00:00 2026-06-07T19:03:55+00:00

I need to place 10 ImageViews alongside one another (in a horizontal row) and

  • 0

I need to place 10 ImageViews alongside one another (in a horizontal row) and they need to fill the entire screen from left to right. So if the total width of the screen is let’s say 100px, then each ImageView would have a width of 10px. Let’s ignore the height of each ImageView.

How in the world, can i accomplish this using dp values and not pixels? I’ve placed inside each ldpi, mdpi and hdpi folder a .jpg image, each having dimensions in respect to this guy’s answer: see here

I’ve tried doing this:

<ImageView 
  android:id="@+id/caca1" 
  android:src="@drawable/tile_11" 
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content" />
<ImageView 
  android:id="@+id/caca2" 
  android:src="@drawable/tile_11" 
  android:layout_toRightOf="@+id/caca1" 
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content" />

... and so on, 'til the 10th ImageView. Each one is place on the right side of the previous.

The above code DOES display them in a row, starting from the left margin of the screen … but i doesn’t reach the right margin.

Is there a way i could stretch each tile to fit the width of the screen, without defining each image view’s width in pixels ?

  • 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-07T19:03:58+00:00Added an answer on June 7, 2026 at 7:03 pm

    Regarding adjusting the height dynamically, I think you’ll have to do this programmatically in your Acivitities OnCreate():

    for each image:

    // image layout adjustment
    LayoutParams lp = mImage.getLayoutParams();
    float width = (float)mImage.getDrawable().getIntrinsicWidth();
    int height = (int)(((float)mContext.getWindowManager().getDefaultDisplay().getWidth() / 10.0f) * ((float)mImage.getDrawable().getIntrinsicHeight() / width));
    
    lp.height = height;
    mImage.setLayoutParams(lp);
    

    height = screen width / 10 (cuz you have 10 images across assuming 0 margins)
    then multiply by ratio of height/width of image. This should keep your image in scale.

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

Sidebar

Related Questions

I need to place two repeated background images on the left and right border
I need to place two images into top-left and top-right corners of a web
I need to place the label text to left and the radio button to
I need to place several DatePicker widgets into the row. If there is not
I need to place a photo in the screen and it should be able
I need to place an image ... at the bottom right corner inside a
I need to place a scroll bar to the left of the contents in
i need to place one textfield with 3 buttons in an alertview. According to
In some situations I need to place a JFrame right where the mouse cursor
I need to place 3 buttons i one line./Using LinearLayout/. Problem is when change

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.