3

alt text

How can I prevent this overlapping from occurring without reducing the font size? Here is my 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">   
    <TextView
        android:id="@+id/nameText"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="Symbol"
        android:textStyle="bold"
        android:textSize="24sp"
        android:layout_width="100dp"
        android:textColor="#4871A8"
        android:paddingTop="2dip"
        android:paddingLeft="5dip"
        android:paddingBottom="1dip"/>
    <TextView
        android:id="@+id/changeText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:gravity="right"     
        android:textSize="18sp"
        android:paddingTop="9dip"
        android:paddingRight="5dip"
        android:paddingBottom="1dip" android:text="13.07(+43.08%)" android:paddingLeft="5dip"/>  
    <ImageView android:layout_toLeftOf="@+id/changeText" android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/verticalDivider" android:background="@drawable/stocks_selected_gradient"></ImageView><TextView
        android:id="@+id/priceText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/changeText"
        android:gravity="right"     
        android:textStyle="bold"
        android:textSize="24sp"
        android:textColor="#4871A8"
        android:paddingTop="2dip"
        android:paddingBottom="1dip"
        android:paddingRight="25dip" android:text="15000"/>  

</RelativeLayout>
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556

2 Answers2

9

In your second TextView, change android:layout_alignParentRight="true" to

android:layout_toRightOf="@+id/nameText"
DonGru
  • 13,532
  • 8
  • 45
  • 55
Wroclai
  • 26,835
  • 7
  • 76
  • 67
1

Encapsulate the TextViews in a LinearLayout (orientation = horizontal). For the individual TVs specify android:layout_weight (remember weights work differently when using android:layout_width=fill_parent/wrap_content)

DonGru
  • 13,532
  • 8
  • 45
  • 55
Sameer Segal
  • 21,813
  • 7
  • 42
  • 56