1

I have a footer in my application, but i am having a problem where the footer gets pushed up each time the keyboard comes out. I have added the "android:windowSoftInputMode="adjustPan" code into my manifest file but it hasn't fixed it. Below is the regular view with keyboard hidden.

This is the normal view with keyboard hidden

This is what my view looks like with the keyboard visible. I would like the keyboard to cover the footer rather than push it up.

second

Below is my code for the layout

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/myCoordinatorLayout"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout 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:id="@+id/icons_container"
        tools:context=".app.LoginActivity">

        <android.support.v7.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:id="@+id/toolBar">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/loginbannerimage"
                android:contentDescription="banner"
                android:layout_gravity="center_horizontal"/>

        </android.support.v7.widget.Toolbar>


        <ScrollView
            android:id="@+id/login_form"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/toolBar">

            <LinearLayout

                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Login progress -->
                <include layout="@layout/custom_progress_bar"/>

                <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:cardUseCompatPadding="true"
                    app:cardElevation="3dp"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    app:cardBackgroundColor="@android:color/black"
                    android:layout_marginBottom="0dp">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal">

                            <android.support.v7.widget.CardView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                app:cardBackgroundColor="@color/toolBar"
                                app:cardCornerRadius="0dp">

                                <TextView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:text="Welcome To MAP"
                                    android:textColor="@android:color/white"
                                    android:textSize="20sp"
                                    android:layout_gravity="center_horizontal"
                                    android:padding="5dp"
                                    android:gravity="center_horizontal" />
                            </android.support.v7.widget.CardView>


                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:orientation="vertical">

                            <android.support.v7.widget.CardView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                app:cardBackgroundColor="@color/cardBg"
                                app:cardCornerRadius="0dp"
                                android:padding="0dp">

                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="match_parent"
                                    android:orientation="vertical"
                                    android:padding="15dp">
                                    <EditText
                                        android:id="@+id/email"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:hint="Email here"
                                        android:maxLines="1"
                                        android:singleLine="true" />

                                    <EditText
                                        android:id="@+id/password"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:hint="Password"
                                        android:imeActionLabel="Password here"
                                        android:imeOptions="actionUnspecified"
                                        android:inputType="textPassword"
                                        android:maxLines="1"
                                        android:singleLine="true" />

                                    <Button
                                        android:id="@+id/email_sign_in_button"
                                        style="?android:textAppearanceSmall"
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:layout_marginTop="16dp"
                                        android:text="Sign-in"
                                        android:textStyle="bold"
                                        android:elevation="5dp"
                                        android:textColor="@color/colorPrimaryDark"
                                        android:background="@android:color/white"
                                        android:layout_gravity="center_horizontal" />
                                </LinearLayout>

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


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

            </LinearLayout>

        </ScrollView>

            <include layout="@layout/footer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true">
            </include>

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>
lagfvu
  • 597
  • 6
  • 21
  • Im facing the same problem.. did you found solution ? android:isScrollContainer="false" this not worked for me – misterios Dec 04 '21 at 20:10

3 Answers3

2

I think it is related with the scrollView, adding line below to the scrollview might solve the issue

android:isScrollContainer="false"

as stated here How to avoid soft keyboard pushing up my layout?

Community
  • 1
  • 1
Deliganli
  • 221
  • 2
  • 10
0

It is because your footer has a height value of

wrap_content

and the other part/s (the ones being compressed) have a value of

match_parent

and if it does not have a certain value or wrap_content it will be compressed to accommodate the keyboard!

0

Or you can use this in your scrollView. This solved my problem.

android:windowSoftInputMode="stateVisible|adjustPan"
LychmanIT
  • 695
  • 6
  • 13