I'm trying to build a layout like the following:
As you can see, you can add new tasks but the buttons at the bottom should always be visible.
This is working with the following XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:float="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:showIn="@layout/activity_edit_reminder">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_reminder_location"
android:textColor="@color/colorPrimary"
android:id="@+id/labelLocationSpinner" />
<Spinner
android:id="@+id/locationSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/label_reminder_location"
android:minHeight="32dp" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_reminder_enabled"
android:textColor="@color/colorPrimary"
android:id="@+id/editReminderEnabled"
android:layout_marginTop="5dp"
android:enabled="true"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/editReminderContent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="horizontal">
<Button
android:id="@+id/button_delete"
android:text="@string/button_delete"
android:onClick="deleteReminder"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".50"
android:layout_marginEnd="5dp"
android:background="@drawable/ripple_red"
android:textColor="#ffffff"
/>
<Button
android:id="@+id/button_save"
android:text="@string/button_save"
android:onClick="saveReminder"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".50"
android:layout_marginStart="5dp"
android:background="@drawable/ripple_green"
/>
</LinearLayout>
</LinearLayout>
As you can see, I'm using an EditText inside the Scrollview. It will then become a scrollable checklist by using this amazing library: https://github.com/federicoiosue/checklistview
What is missing is that I'd like the buttons to stay behind the keyboard when the user is writing tasks. Right now, this will happen:
If I add android:windowSoftInputMode="adjustNothing"
to my manifest for that activity, then when the keyboard is shown it will overlap the tasks and buttons.