This codes works fine when the items in the recycler view are 3 or 4. When the items in recycler view are more then 4 then the edit text field goes out of the screen.Like in image https://i.stack.imgur.com/Kb4ut.jpg
EditText should not go below Bottom aligned button when there will be multiple items in recyclerview. How can I achieve this? https://i.stack.imgur.com/0IkA6.jpg
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorWhitex"
tools:context=".Fragments.RecordOdometerFragments.RecordOdometer">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:id="@+id/linear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout">
<android.support.v7.widget.RecyclerView
android:id="@+id/car_selection_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"/>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/odometer_view"
android:layout_below="@+id/car_selection_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/edittext_red_corners">
<EditText
android:id="@+id/odometer_edittext"
android:layout_height="35dp"
android:layout_width="fill_parent"
android:inputType="number"
android:layout_margin="1dp"
android:paddingEnd="64dp"
android:maxLines="9"
android:imeOptions="actionDone"
android:hint="Input meter reading"
android:background="@null"
android:paddingStart="16dp" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="32dp"
android:layout_height="32dp"
android:clickable="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_mic_none_black_24dp"/>
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="32dp"
android:layout_height="32dp"
android:clickable="true"
android:layout_toLeftOf="@+id/imageButton1"
android:layout_centerVertical="true"
android:src="@drawable/ic_photo_camera_black_24dp"
android:background="?attr/selectableItemBackgroundBorderless" />
</RelativeLayout>
</RelativeLayout>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="32dp"
android:layout_alignParentBottom="true"
android:background="@drawable/button_corner_radius"
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
android:gravity="center"
android:text="Done"
android:textAllCaps="false"
android:textColor="@color/colorWhite" />
</RelativeLayout>