Problem with TextViews running into each other in RelativeLayout
Posted
by Janusz
on Stack Overflow
See other posts from Stack Overflow
or by Janusz
Published on 2010-03-17T14:21:02Z
Indexed on
2010/03/17
15:01 UTC
Read the original article
Hit count: 607
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="information"
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:
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?
© Stack Overflow or respective owner