I've got a problem with an android layout.
I've got one line with three TextViews: a job title, an age and a date. I want the date to be aligned to the right and the job title to the left. The age should be aligned right to the job title.
The problem is that the job title can become very long. I want that it does not overlap the other to views but gets truncated automatically instead. The other two text views should always be visible.
Any ideas how I can achieve this? I want my layout to span the whole width of the screen and thus don't want to work with absolute widths.
My layout looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Softwaredeveloper and some more very long job titles so that the text overflows"
android:id="@+id/occupation"
android:layout_gravity="left|center_vertical"
android:padding="5dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:singleLine="true"
android:ellipsize="end"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(32)"
android:id="@+id/age"
android:layout_gravity="left|center_vertical"
android:padding="5dp"
android:layout_alignParentLeft="false"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/occupation"
android:singleLine="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="01.02.2013"
android:id="@+id/date"
android:layout_alignParentLeft="false"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:singleLine="true"
android:padding="5dp"/>
</RelativeLayout>
And this is what I get: