android - Layout Chat bubble -
android - Layout Chat bubble -
i'm trying create layout whatsapp chat, have 9 patch image can not image below:
currently looks this:
my axml file:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="10dp"> <textview android:id="@+id/singlemessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_margin="5dip" android:paddingleft="10dip" android:text="hello bubbles!" android:textcolor="#48026e" /> <textview android:id="@+id/datetime" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="right" android:text="00:00" android:textcolor="#48026e" />
change orientation of linear layout vertical. , move datetime textview right side using gravity attribute.
also alter width of singlemessage match_parent
i changed xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:background="@drawable/ic_patch" android:orientation="vertical" > <textview android:id="@+id/singlemessage" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_margin="5dip" android:paddingleft="10dip" android:text="hello bubbles!" android:textcolor="#48026e" /> <textview android:id="@+id/datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="00:00" android:textcolor="#48026e" /> </linearlayout>
and it's working expected.
android android-layout android-linearlayout
Comments
Post a Comment