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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:16:34+00:00 2026-05-16T07:16:34+00:00

I have been having problems creating a relative layout in XML for a list

  • 0

I have been having problems creating a relative layout in XML for a list item to be used for a series of items in a ListView. I have tried for hours and am tearing my hair out trying to get it to look how I want but cannot get everything to appear in the correct spot and not overlap or mis-align. I can get the first image and next two textviews in place but cannot get the last textview and imageview.

I have attached a wireframe style image of how I am trying for it to look and was wondering if someone could help me out?

alt text

  • The ImageView on the right is a set icon of the full height of the row with padding around it?
  • The two TextViews take up the majority of the width. The Address textview has the possibility of the text being long so it may need to get truncated if it runs out of space, or ideally have the font size shrink?
  • The next TextView will just hold a small string of max 5 characters.
  • The last ImageView is a small arrow to imply that this list item is clickable for more infomation. It needs to be centred like shown.
  • I would like if the icon, last textview, and last image always be in the same place/alignment down the list.

If someone could offer some assistance on this I would be so grateful.

Cheers guys

  • 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-16T07:16:34+00:00Added an answer on May 16, 2026 at 7:16 am

    For anyone interested I managed to get this working. I know how much of a pain it is to go searching for an answer to a problem and it was never completely resolved.

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    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" />
    <TextView
        android:id="@+id/topLine"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:lines="1"
        android:layout_toRightOf="@+id/Icon"
        android:layout_toLeftOf="@+id/distance"
        android:textColor="@color/blacktext"
        android:textSize="20dip"
        android:text="Name" />
    <TextView
        android:id="@+id/bottomLine"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:lines="1"
        android:layout_toRightOf="@+id/Icon"
        android:layout_below="@+id/topLine"
        android:layout_toLeftOf="@+id/distance"
        android:textColor="@color/blacktext"
        android:textSize="15dip"
        android:text="Address" />
    <TextView 
        android:id="@+id/distance"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/arrow"
        android:layout_centerVertical="true"
        android:layout_width="wrap_content"
        android:lines="1"
        android:textColor="@color/blacktext"
        android:textSize="12dip"
        android:text="100m" />
    <ImageView 
        android:id="@+id/arrow"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_margin="5dip"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true" 
        android:src="@drawable/redarrow"/>
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been having problems with creating a download list of files for a
I have a PHP application that I have been having some problems with, some
I'm working on http://lobounce.com.s138810.gridserver.com/ and have been having some problems with the slider which
I have been having these really odd problems with Visual Studio 2010. At this
I'm having problems refreshing .Net 2.0 with IIS 6. I have been able to
Lately we been having a lot of problems with our mysql server i have
I've been having problems creating a foreign key in Java Db through Netbeans. I'm
I am having problems with my java assignment. I have been working on it
I have been creating multiple background threads to parse xml files and recreate new
I'm having big problems while creating a simple program in C. I have 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.