The situation is as follows. I make a template for a text message on the messenger message screen.
For layout, I use RelativeLayout, inside of which is a TextView with the text of the message and another 1 RelativeLayout with the image of the read message and the TextView over time.
This message should be located on the right side of the screen. For small messages, everything is fine:
But for long messages that no longer fit into 1 line, problems begin:
I can not understand why the text goes beyond the edge of the parent RelativeLayout? At the same time, the android:layout_alignParentLeft and android:layout_alignParentStart have no effect whatsoever. The shift is removed if you remove the binding of the element with the text to RelativeLayout with time and status, but they begin to overlap each other.
I give the full layout code below:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="62dp"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/talk_message_my" android:paddingTop="9dp" android:paddingLeft="11dp" android:paddingBottom="7dp" android:paddingRight="18dp" android:layout_alignParentEnd="true" android:gravity="right"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Денег нет, но вы держитесь. Всего вам хорошего, счастья, здоровья" android:id="@+id/message" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> <RelativeLayout android:layout_width="48dp" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:id="@+id/relativeLayout4" android:layout_alignBottom="@+id/message" android:layout_toEndOf="@+id/message"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/status" android:src="@drawable/icon_message_read" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="15:21" android:id="@+id/time" android:textSize="@dimen/label_font_size" android:layout_toRightOf="@+id/status" /> </RelativeLayout> </RelativeLayout> </RelativeLayout> 


