androidwindow-soft-input-modeadjustpan

adjustPan pushing my layout and hiding status bar


Using adjustPan in manifest pushes my layout to the top and makes my UI look ridiculous.

This is my Android manifest:

<activity
        android:name=".AddNote"
        android:label="@string/title_activity_add_note"
        android:windowSoftInputMode="stateVisible|adjustPan">

This is my XML file:

<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"
tools:context="com.dinosaur.cwfei.materialnotes.AddNote">

<include
    android:id="@+id/app_bar"
    layout="@layout/app_bar_no_spinner" />

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/cardview_margin">
        <ScrollView
            android:id="@+id/scroll_view"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
          >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="@dimen/activity_vertical_margin"
            android:orientation="vertical">

            <EditText

                android:id="@+id/editTextTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/margin_16"
                android:background="@color/transparent"
                android:hint="@string/hint_title"
                android:textStyle="bold" />

            <EditText

                android:id="@+id/editTextDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/transparent"
                android:hint="@string/hint_note" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginBottom="@dimen/margin_16"
                android:layout_marginTop="100dp"
                android:background="@color/divider_color" />

        </LinearLayout>
        </ScrollView>
    </android.support.v7.widget.CardView>

</LinearLayout>

Solution

  • Solved it by using adjustResize instead of adjustPan, set fitsSystemWindows="true" in case adjustResize was not working.