title: android LinearLayout - ImageView gets pushed off the screen
body: <p>I use the layout posted below to show messages by inflating that layout as a row into a ListView. The problem is that it works fine with a single-line message but when there are 2 lines or more the <code>ImageView</code> indicating the message state gets pushed off the screen, can't get the reason. Any ideas? Layout code and screenshot below.</p>
  
  <p><img src="https://i.stack.imgur.com/GFYxK.png" alt="enter image description here"></p>
  
  <p>That is the inflated layout:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/RelativeLayout1"
      android:layout_width="match_parent"
     android:layout_height="match_parent"
      android:padding="5dp" &gt;
  
  &lt;TextView
      android:id="@+id/tvTimestamp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_alignParentLeft="true"
      android:text="TextView"
      android:textAppearance="?android:attr/textAppearanceSmall"
      android:textSize="8sp" /&gt;
  
  &lt;LinearLayout
      android:id="@+id/rl_message_holder"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_marginLeft="5dp"
      android:layout_marginRight="5dp"
      android:layout_toRightOf="@+id/tvTimestamp"
      android:background="@drawable/outgoing_bg"
  
      android:orientation="horizontal" &gt;
  
      &lt;TextView
          android:id="@+id/tvMessageOutgoing"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:padding="4dp"
          android:text="Medium Text"
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
      &lt;ImageView
          android:id="@+id/imgMessageState"
          android:layout_width="20dp"
          android:layout_height="20dp"
          android:layout_gravity="bottom"
          android:src="@drawable/ic_launcher" /&gt;
  
    &lt;/LinearLayout&gt;
  
   &lt;/RelativeLayout&gt;
  </code></pre>