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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:48:57+00:00 2026-05-25T06:48:57+00:00

I need to place three elements inside RelativeLayout : scaled image in ImageView on

  • 0

I need to place three elements inside RelativeLayout:

  • scaled image in ImageView on the right side with the top and bottom margins
  • TextEdit in the left top corner
  • LinearLayout in the rest of the space (below the title and to the left of the image)

The problem happens when the image is scaled in ImageView. I want it fits the entire parent’s height considering margins. After scaling uniformly to fit the parent’s height I want ImageView wraps the image’s width. But as the result there are some unfilled horizontal spaces in ImageView.

The problem looks similar to one solved here. But in my case all tests with android:adjustViewBounds and android:scaleTypes didn’t work. I suppose there is a problem because of margins and RelativeLayout use.

Here is the extract from my xml file:

<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

    <ImageView 
      android:id="@id/albums_slideshow"
      android:adjustViewBounds="true"
      android:layout_marginTop="71.33dp"
      android:layout_marginBottom="88.67dp"
      android:scaleType="centerInside"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:layout_alignParentRight="true"
      android:src="@drawable/music_img_album_noimage"/>

    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="@dimen/music_module_screen_title_margin_left"
      android:layout_marginTop="@dimen/music_module_screen_title_margin_top"
      android:text="@string/music_string"
      style="@style/ScreenTitleFont"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"/>

    <LinearLayout
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_alignParentLeft="true"
      android:layout_alignTop="@id/albums_slideshow" 
      android:layout_toLeftOf="@id/albums_slideshow">

        ... 

      </LinearLayout>
 </RelativeLayout>

Has anyone met this problem and found the answer?

  • 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-25T06:48:57+00:00Added an answer on May 25, 2026 at 6:48 am

    this is what i have come up with

    enter image description here

    and this is the xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
      android:layout_width="fill_parent" android:layout_height="fill_parent"
      android:orientation="vertical"
    >
    <TextView android:id="@+id/album_text"
      android:layout_width="wrap_content" android:layout_height="wrap_content"
      android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
      android:layout_marginLeft="20dip" android:layout_marginTop="20dip"
      android:text="music string" android:background="@android:color/white"
    />
    
    <LinearLayout android:id="@+id/albums_list"
      android:layout_width="wrap_content" android:layout_height="fill_parent"
      android:layout_alignParentLeft="true" android:layout_below="@id/album_text"
      android:layout_marginTop="71.33dp" 
      android:orientation="vertical" android:background="@android:color/white"
    >
    <TextView android:id="@+id/album_text"
      android:layout_width="wrap_content" android:layout_height="wrap_content"
      android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
      android:layout_marginLeft="20dip" android:layout_marginTop="20dip"
      android:text="albums list"  
    />
    </LinearLayout>
    
    <ImageView android:id="@+id/albums_slideshow"    
      android:layout_height="fill_parent" android:layout_width="wrap_content"     
      android:layout_alignParentRight="true"
      android:layout_marginBottom="88.67dp"
      android:layout_alignTop="@id/albums_list" 
      android:scaleType="centerInside"
      android:layout_centerInParent="true" android:background="@android:color/darker_gray"
      android:src="@drawable/icon"/>
    </RelativeLayout>
    

    let me know for improvements

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

Sidebar

Related Questions

I need to take an image and place it onto a new, generated white
I need to parse a value from an xml and place it to image's
Can I somehow use CSS to place the block2 in top right corner of
I want to place a variable number of HTML lists side by side inside
I need to place default text to all rows for particular column in jquery
We need to place text over objects in a web page, similar to this:
As a programmer I need a place to store my stuff. I've been running
For an embedded system I need to place a few data structures at fixed
I have outer div and inner div. I need to place inner div at
I'm developing a graph control in WPF. I need to place a Canvas on

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.