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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:14:07+00:00 2026-05-23T16:14:07+00:00

I’m trying to position two TextView’s to the right of an image view (note

  • 0

I’m trying to position two TextView’s to the right of an image view (note this is not in a list). I followed this example which works but problems occur when I start to increase the text size and background of the TextView. Here the top text view seems to expand despite setting the height to wrap_content.

Looking at the example I don’t really understand

android:layout_height=”?android:attr/listPreferredItemHeight”

and why the layout height is set to 26dip

android:layout_height=”26dip”

Here is my xml with the minor changes to layout_height which I thought would work

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

    android:padding="6dip">

    <ImageView android:id="@+id/icon" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true" android:layout_marginRight="6dip"

        android:src="@drawable/icon" />

    <TextView android:id="@+id/secondLine" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_toRightOf="@id/icon"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true" android:background="@layout/rounded"
        android:textSize="20sp" android:singleLine="true" android:textColor="#FFFFFF"
        android:textStyle="bold" android:ellipsize="marquee" android:padding="10dip"
        android:layout_margin="5dip"
        android:text="Simple application that shows how to use RelativeLayout" />

    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:background="@layout/rounded"
        android:layout_toRightOf="@id/icon" android:textSize="20sp"
        android:singleLine="true" android:textColor="#FFFFFF"
        android:textStyle="bold" android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" android:layout_above="@id/secondLine"
        android:padding="10dip" android:layout_margin="5dip" android:gravity="center_vertical"
        android:text="My Application" />

</RelativeLayout>

And this is the resulting image???

enter image description here

Any help would be appreciated.

I just stumbled on this post which seems to work

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:padding="6dip">
    <ImageView android:id="@+id/Icon" android:layout_margin="5dip"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_centerVertical="true" android:src="@drawable/addphoto" />
    <TextView android:id="@+id/topLine" android:layout_height="wrap_content"
        android:layout_width="fill_parent" android:layout_margin="4dip"
        android:layout_toRightOf="@+id/Icon" android:background="@layout/rounded"
        android:padding="10dip" android:textSize="20sp" android:singleLine="true"
        android:textColor="#FFFFFF" android:textStyle="bold" android:text="Name" />
    <TextView android:id="@+id/bottomLine" android:layout_height="wrap_content"
        android:layout_width="fill_parent" android:layout_margin="4dip"
        android:layout_toRightOf="@+id/Icon" android:layout_below="@+id/topLine"
        android:padding="10dip" android:background="@layout/rounded"

        android:textSize="20sp" android:singleLine="true" android:textColor="#FFFFFF"
        android:textStyle="bold" android:text="Address" />

</RelativeLayout>
  • 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-23T16:14:07+00:00Added an answer on May 23, 2026 at 4:14 pm

    You see that result because you have the following attributes on the textview: android:layout_alignParentTop="true" and android:layout_above="@id/secondLine".

    The above attributes specify that the top must be aligned with the parent and the bottom must be just above the ‘secondline’ component.

    I removed the above two attributes and did a few more changes to your layout to get to what I believe you want. See the layout below. I hope this layout achieves what you wish to obtain.

    <?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="wrap_content"
    
    android:padding="6dip">
    
    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginRight="6dip"
    
        android:src="@drawable/icon" />
    
    <TextView
        android:id="@+id/secondLine"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/icon"
        android:layout_below="@+id/text"
        android:layout_alignParentRight="true"
        android:textSize="20sp"
        android:singleLine="true"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        android:ellipsize="marquee"
        android:padding="10dip"
        android:layout_margin="5dip"
        android:text="Simple application that shows how to use RelativeLayout" />
    
    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/icon"
        android:layout_alignBaseline="@id/icon"
        android:textSize="20sp"
        android:singleLine="true"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        android:padding="10dip"
        android:layout_margin="5dip"
        android:gravity="center_vertical"
        android:text="My Application" />
    

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.