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

The Archive Base Latest Questions

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

I have a problem with two Textviews on the same height in a RelativeLayout

  • 0

I have a problem with two Textviews on the same height in a RelativeLayout running into each other.

I use the following Layout.

<?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">

<ImageView 
       android:id="@+id/logo" 
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" 
       android:adjustViewBounds="true"
       android:scaleType="centerInside"
       android:src="@drawable/icon" />

<TextView 
       android:id="@+id/name"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content" 
       android:text="NameNameNameNameNameNameName"
       android:layout_alignParentTop="true"
       android:layout_toRightOf="@id/logo"
       android:gravity="clip_horizontal" 
       android:lines="1" />

<TextView 
      android:id="@+id/information"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Distance"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="true" />

<TextView
      android:id="@+id/nrcoupons"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Number"
      android:layout_alignRight="@id/information"
      android:layout_alignBottom="@id/logo" />

<TextView
      android:id="@+id/subcategory"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" 
      android:text="Subcategory"
      android:layout_alignLeft="@id/name"
      android:layout_alignBottom="@id/logo" />

</RelativeLayout>

This gives me this view:

alt text http://janusz.de/~janusz/view.png

Everything is as I need it except the two textviews name and information are displayed on the same screen space with the one on top of the other.

How can I avoid this?

  • 1 1 Answer
  • 1 View
  • 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-14T02:07:08+00:00Added an answer on May 14, 2026 at 2:07 am

    For your @+id/name TextView, add android:layout_toLeftOf="..." for whatever TextView is on the right. The screenshot and the XML do not seem to line up (screenshot appears to have “Distance” in the overwritten TextView, but the XML does not), so I’m not completely certain which widget this is.

    If you are targeting Android 1.5, you will need to order the widgets in the XML such that the widgets are defined before they are referenced from android:layout_toLeftOf or android:layout_toRightOf. If you are targeting Android 1.6 and newer only, you can have them be in any order, but the first occurrence of any distinct ID must have the + sign, even if that first occurrence is in an android:layout_toLeftOf attribute instead of an android:id attribute.

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

Sidebar

Related Questions

Problem: I have two spreadsheets that each serve different purposes but contain one particular
Avast there fellow programmers! I have the following problem: I have two rectangles overlapping
I actually have two questions regarding the same problem but I think it is
Ok I have two modules, each containing a class, the problem is their classes
Problem: a table of coordinate lat/lngs. Two rows can potentially have the same coordinate.
I am wondering how you would approach this problem I have two Taxrates that
So. I have a problem where I have two versions of GCC on a
I used pole display(E POS) in my POS c# application.I have two major problem
The problem: I often have to update two or more repositories: One for the
Here's my problem at a high level: We have two business applications. App1 inputs

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.