title: Making Recyclerview Fixed Height and Scrollable
body: <p>SOLVED CHECK ANSWER BELOW...</p>
  
  <p>So I am trying to create a comments functionality for my Android app and I want to display the comments inside a recyclerview and then have a button and textview below the recyclerview to add comments. I want to have the recyclerview a certain height and make it scrollable if there are lots of comments because I dont want the users to have to scroll down the screen to find the add button. </p>
  
  <p>I couldn't get it to work so I was wondering if anyone else had that issue.</p>
  
  <p>I have all the adapter and everything set up, I am just having trouble with the recyclerview. </p>
  
  <p>Thanks. </p>
  
  <p>I prob was not clear on what I was trying to accomplish. I am trying to create a cardview where it will display all the comments and the ability to add a new comment. The recyclerview will take up approx 80% of the height and then the last 20% is for the edittext and button. </p>
  
  <p>My XML (Scroll to last cardview where the recyclerview is)</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:id="@+id/scrollview"&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:fab="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".ProfilePageActivity"
      &gt;
  
      &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/profilepagetoolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?attr/colorPrimary"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
          android:minHeight="?attr/actionBarSize"&gt;
  
      &lt;/android.support.v7.widget.Toolbar&gt;
      &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:clickable="true"
          android:layout_marginTop="35dp"
          android:layout_below="@+id/profilepagetoolbar"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="15dp"
          android:layout_marginRight="15dp"
          android:id="@+id/aboutCard"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="300dp"
              android:gravity="center_vertical"
              android:orientation="vertical"
              android:layout_alignTop="@+id/aboutCard"
              android:focusable="true"
              android:focusableInTouchMode="true"&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="4dp"
                  android:layout_marginEnd="10dp"
                  android:layout_marginStart="10dp"
                  android:layout_marginTop="-60dp"
                  android:gravity="center_vertical"
                  android:maxLines="1"
                  android:textColor="@color/text"
                  android:textSize="20sp"
                  android:text="ABOUT" /&gt;
  
              &lt;View
                  android:layout_width="match_parent"
                  android:layout_height="1px"
                  android:background="@color/dividers" /&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:paddingTop="10dp"&gt;
  
                  &lt;ImageView
                      android:id="@+id/nameicon"
                      android:layout_width="24dp"
                      android:layout_height="24dp"
                      android:layout_margin="8dp"
                      android:transitionName="appIcon"
                      android:background="@drawable/ic_account_circle_black_24dp"/&gt;
                  &lt;TextView
                      android:id="@+id/Name"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="4dp"
                      android:layout_marginEnd="10dp"
                      android:layout_marginStart="10dp"
                      android:layout_marginTop="8dp"
                      android:gravity="center_vertical"
                      android:maxLines="1"
                      android:textColor="@color/secondary"
                      android:textSize="20sp" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:paddingTop="10dp"&gt;
  
                  &lt;ImageView
                      android:id="@+id/locationicon"
                      android:layout_width="24dp"
                      android:layout_height="24dp"
                      android:layout_margin="8dp"
                      android:transitionName="appIcon"
                      android:background="@drawable/ic_map_black_24dp"/&gt;
                  &lt;TextView
                      android:id="@+id/Location"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="4dp"
                      android:layout_marginEnd="10dp"
                      android:layout_marginStart="10dp"
                      android:layout_marginTop="11dp"
                      android:gravity="center_vertical"
                      android:maxLines="1"
                      android:textColor="@color/secondary"
                      android:textSize="15sp" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:paddingTop="10dp"&gt;
  
                  &lt;ImageView
                      android:id="@+id/websiteIcon"
                      android:layout_width="24dp"
                      android:layout_height="24dp"
                      android:layout_margin="8dp"
                      android:transitionName="appIcon"
                      android:background="@drawable/ic_explore_black_24dp"/&gt;
                  &lt;TextView
                      android:id="@+id/Website"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="4dp"
                      android:layout_marginEnd="10dp"
                      android:layout_marginStart="10dp"
                      android:layout_marginTop="11dp"
                      android:gravity="center_vertical"
                      android:maxLines="1"
                      android:textColor="@color/secondary"
                      android:textSize="15sp" /&gt;
              &lt;/LinearLayout&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
      &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:clickable="true"
          android:layout_marginTop="35dp"
          android:layout_below="@+id/aboutCard"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="15dp"
          android:layout_marginRight="15dp"
          android:id="@+id/writeComment"
          android:layout_alignParentTop="false"
          android:layout_alignParentBottom="false"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="300dp"
              android:gravity="center_vertical"
              android:orientation="vertical"
              android:focusable="true"
              android:focusableInTouchMode="true"&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="4dp"
                  android:layout_marginEnd="10dp"
                  android:layout_marginStart="10dp"
                  android:layout_marginTop="-100dp"
                  android:gravity="center_vertical"
                  android:maxLines="1"
                  android:textColor="@color/text"
                  android:textSize="20sp"
                  android:text="Comments" /&gt;
  
              &lt;View
                  android:layout_width="match_parent"
                  android:layout_height="1px"
                  android:background="@color/dividers"
                  android:id="@+id/divider"/&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:weightSum="1"&gt;
  
                  &lt;EditText
                      android:layout_width="244dp"
                      android:layout_height="wrap_content"
                      android:id="@+id/editComment"
                      android:layout_below="@+id/divider"
                      android:textColor="@color/text"
                      android:hint="Write a comment..."/&gt;
  
                  &lt;Button
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Create"
                      android:id="@+id/btnComment"
                      android:layout_gravity="center_horizontal" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
      &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:clickable="true"
          android:layout_marginTop="20dp"
          android:layout_below="@+id/writeComment"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="15dp"
          android:layout_marginRight="15dp"
          android:id="@+id/commentsCard"&gt;
  
          &lt;LinearLayout
              android:layout_alignParentTop="true"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"&gt;
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="4dp"
                  android:layout_marginEnd="10dp"
                  android:layout_marginStart="10dp"
                  android:layout_marginTop="0dp"
                  android:gravity="center_vertical"
                  android:maxLines="1"
                  android:textColor="@color/text"
                  android:textSize="20sp"
                  android:text="Comments" /&gt;
  
              &lt;android.support.v7.widget.RecyclerView
                  android:id="@+id/commentsList"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:focusableInTouchMode="true" /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/RelativeLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p><strong>The second and first comment are being cut off.</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/qRsW9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qRsW9.png" alt="enter image description here"></a></p>