Search code examples
androidandroid-layoutwindow-soft-input-mode

android - windowSoftInputMode issue


How to I show the relative layout in the red area when soft input opened? I tried adjustPan and adjustResize input modes but did not happen. Any ideas?

enter image description here


enter image description here


Solution

  • First, add android:windowSoftInputMode="adjustResize" to your activity at manifest.xml.

    Then create layout like below.

    • As Parent, use RelativeLayout
    • Put Inside 2 children(ScrollView and Bottom View)
    • Bottom View aligned to bottom.
    • ScrollView located above from Bottom View.

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:layout_above="@+id/bottomView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            //scrollable content
        </ScrollView>
    
        <RelativeLayout
            android:id="@+id/bottomView"
            android:layout_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            //your bottom content
        </RelativeLayout >
    </RelativeLayout>