I have a chat list view in which the sender's name should be left-aligned and the recipient's response should be on the right, and then vice versa when the recipient becomes the sender.
Here is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/chatmessagename" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:textSize="16sp" android:textStyle="bold" android:paddingBottom="1dp" /> <TextView android:id="@+id/chatmessagedate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:autoLink="none" /> <TextView android:id="@+id/chatmessagetext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@id/chatmessagename" android:autoLink="all" />
Now at runtime I want to change the value of textview layout_alignParentRight. Can this be done?
source share