title: RecyclerView is taking full screen to show one message
body: <p>i am working on a layout for chat screen in which i am using RecyclerView to show messages sent and receive by user but the problem which i am facing is RecyclerView is showing only one message in whole screen and to see other message i have to scroll down or scroll up. i want to show messages next to eachother vertically.
  Here is my xml code:- </p>
  
  <pre><code>&lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/chatparent"
      android:background="@color/background"&gt;
      &lt;include layout="@layout/chattoolbar"/&gt;
  
  
  
  
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/rv_messages"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:scrollbars="vertical"
          android:scrollbarStyle="outsideOverlay"/&gt;
  
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="bottom"&gt;
  
  
  
  
     &lt;LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"&gt;
  
  
  
  
              &lt;FrameLayout
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="0.80"
                  android:background="@color/colorPrimary" /&gt;
  
              &lt;FrameLayout
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="0.20"
                  android:background="@color/black"/&gt;
  
     &lt;/LinearLayout&gt;
  
  
          &lt;RelativeLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/rl_typing"
              android:background="@drawable/chatbox"
              android:orientation="horizontal"
              android:paddingLeft="5dp"
              android:paddingRight="10dp"
              android:layout_marginStart="15dp"
              android:layout_marginBottom="5dp"
              android:layout_marginTop="5dp"
              android:layout_marginEnd="2dp"
              &gt;
  
  
              &lt;Button
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:background="@drawable/ic_emoticons"
                  android:layout_marginTop="8dp"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:gravity="bottom"
                  android:id="@+id/btn_emoji"
                  /&gt;
  
  
  
              &lt;EditText
                  android:layout_width="190dp"
                  android:layout_height="wrap_content"
                  android:inputType="textMultiLine"
                  android:minLines="1"
                  android:maxLines="20"
                  android:lines="8"
                  android:imeActionId="@+id/send"
                  android:imeActionLabel="actionSend"
                  android:imeOptions="actionSend"
                  android:scrollbars="vertical"
                  android:textColor="@color/monsoon"
                  android:textColorHint="@color/dark_gray"
                  android:id="@+id/et_message"
                  android:textSize="13sp"
                  android:hint=" Type Your Message Here..."
                  android:layout_toEndOf="@id/btn_emoji"
                  tools:ignore="HardcodedText" /&gt;
  
  
  
              &lt;Button
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:background="@drawable/ic_attachment"
                  android:layout_marginTop="8dp"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:gravity="bottom"
                  android:id="@+id/btn_attach"
                  android:layout_toEndOf="@id/et_message"/&gt;
  
  
              &lt;Button
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:background="@drawable/ic_camera"
                  android:layout_marginTop="8dp"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:id="@+id/btn_camera"
                  android:layout_toEndOf="@id/btn_attach"/&gt;
  
  
          &lt;/RelativeLayout&gt;
  
          &lt;Button
              android:layout_width="30dp"
              android:layout_height="35dp"
              android:id="@+id/btn_send"
              android:layout_alignParentTop="true"
              android:layout_marginTop="7.5dp"
              android:layout_centerHorizontal="true"
              android:layout_marginStart="3dp"
              android:layout_toEndOf="@id/rl_typing"
              android:background="@drawable/ic_send" /&gt;
  
  
  
  
      &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the recyclerView_item.xml :- </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:paddingBottom="5dp"
      android:paddingTop="5dp"
      android:paddingLeft="10dp"&gt;
  
  
      &lt;TextView
          android:id="@+id/username"
          style="?android:textAppearanceMedium"
          android:textColor="?android:textColorPrimary"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:singleLine="true"
          android:textStyle="bold"/&gt;
  
     &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
         android:orientation="vertical"&gt;
  
  
      &lt;TextView
          android:id="@+id/txtOther"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textSize="16dp"
          android:textColor="@color/black"
          android:paddingLeft="20dp"
          android:paddingRight="20dp"
          android:paddingTop="5dp"
          android:paddingBottom="5dp"
          android:background="@drawable/chat_in"/&gt;
  
      &lt;TextView
          android:id="@+id/message"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@drawable/chat_out"
          android:paddingBottom="5dp"
          android:paddingLeft="20dp"
          android:paddingRight="20dp"
          android:paddingTop="5dp"
          android:textColor="@color/white"
          android:textSize="16dp" /&gt;
  
         &lt;TextView
             android:id="@+id/lblDate"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="12dp"
             android:textColor="@color/colorprimarylight"
             android:textStyle="italic"
             android:padding="5dp"
             /&gt;
  
  &lt;/LinearLayout&gt;
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the screenshot in which you can see how much space it is producing in between two messages.<a href="https://i.stack.imgur.com/TdBIn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TdBIn.png" alt="Screenshot"></a></p>