I have a DialogFragment
with the following layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_rect_light">
<RelativeLayout
android:id="@+id/create_note_top_panel"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#f2f3f5">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Cancel"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:gravity="center"
android:layout_centerInParent="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Send"/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/quote_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_alignParentTop="true"
android:src="@drawable/edu4_create_note_quotes"/>
<TextView
android:id="@+id/quote_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/quote_image"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:text="The issue is that soft keyboard is very tricky and this\n quesakdf\njk\nlsd\nfj\nklsdjfklsdjfkl jsdklfj skldjkljfklsdjklfjsdklfjsdkljfkls"
android:maxLines="5"/>
<EditText
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@id/quote_text"
android:layout_margin="10dp"
android:gravity="top|left"
android:background="@drawable/rounded_rect_background_white"
android:padding="5dp"/>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="15dp"
android:layout_marginLeft="10dp">
<TextView
android:id="@+id/visibleTo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:text="Publish"/>
<ToggleButton
android:id="@+id/switchPublishToCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"/>
</LinearLayout>
I want that when the keyboard is opened, the top panel (android:id="@+id/create_note_top_panel"
) will be visible on top, and the dialog (it's background) will be above the keyboard, the bottom TextView
and ToggleButton
will be visible and the rest of the layout will be scrollable.