i'm new in Android developement(sorry for my english i m french). I have an application with a listview. For the listview i have a custom line.
I want to have this result :
Here is my code :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:minHeight="60dp"
android:gravity="end" >
<TextView
android:id="@+id/messageID"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="gone"/>
<TextView
android:id="@+id/messageContactID"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="visible"/>
<TextView
android:id="@+id/messageContact"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@color/previewContact"
android:gravity="center"
android:textColor="@color/white"
/>
<TextView
android:id="@+id/messageText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_toLeftOf="@id/messageContact"
android:background="@color/home_bg"
/>
</RelativeLayout>
Could you please help me?
Ps i cant use linear layout
Try this:
<?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="match_parent"
android:minHeight="60dp"
android:gravity="end" >
<TextView
android:id="@+id/messageID"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="gone"/>
<TextView
android:id="@+id/messageContactID"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="visible"/>
<TextView
android:id="@+id/messageContact"
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:background="@color/previewContact"
android:textColor="@color/white"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/messageText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_alignParentLeft="true"
android:background="@color/home_bg"
android:layout_toLeftOf="@+id/messageContact" />
</RelativeLayout>