Good day! I can not adequately solve this problem:

I have a screen with EditText in the ScrollView layer, and at the very bottom there is a button and all this in LinearLayout.

I open the keyboard by clicking on one of the editText and this button below stands above the open keyboard and overlaps the other EditText with it.

So the question is how not to move the button up when opening the keyboard, but so that the other elements move?

With the manifest worked at random (stateHidden so that initially the keyboard was not): android:windowSoftInputMode="stateHidden|adjustResize"

android:windowSoftInputMode="stateHidden|adjustPan"

In the 2nd version, the button does not rise, but the EditText layer does not rise either.

Manifest code

 <activity android:name=".activities.OrderScreenActivity" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="stateHidden|adjustResize"/> 

Screen code

 <?xml version="1.0" encoding="utf-8"?> 

 <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar_order" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp" android:weightSum="1"> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/til_name_act_order" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/ed_name_act_order" android:hint="Имя" android:textColor="@color/text_color_353535" android:imeOptions="actionNext" android:inputType="text" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Телефон" android:id="@+id/ed_tel_act_order" android:inputType="phone" android:maxLength="17" android:textColor="@color/text_color_353535" android:digits="0,1,2,3,4,5,6,7,8,9" android:imeOptions="actionNext" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Адрес" android:id="@+id/ed_address_act_order" android:textColor="@color/text_color_353535" android:inputType="text" android:imeOptions="actionNext" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Комментарии" android:id="@+id/ed_comment_act_order" android:textColor="@color/text_color_353535" android:inputType="textMultiLine" /> </android.support.design.widget.TextInputLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv_summ_act_order" android:textColor="@color/text_color_353535" android:textSize="18sp" android:text=" Общая сумма: " android:layout_marginTop="4dp" /> </LinearLayout> </ScrollView> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <ProgressBar style="?android:attr/progressBarStyle" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/progressBar_act_order" android:visibility="gone" /> <View android:layout_width="match_parent" android:layout_height="@dimen/height_border_line_item" android:background="@color/color_border_item" /> <Button android:text="Оформить" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btn_send_order_act_order" android:background="@drawable/bg_selector_order" android:textColor="@drawable/btn_order_text_color" /> </LinearLayout> 

Screenshots of how it works now

here we focus during transitions editText'y shifted when you hide the keyboard, the button finally gets down

Specially put input fields in ScrollView, since the comment field is enlarged and can be stretched to full screen, and the button should be constantly on the screen.

I changed the ScrollView to FrameLayout and transferred the layer with the button inside with gravity: bottom, but then the layer also overlaps, but becomes transparent.

In general, I want to shift only the layer with input fields, but so that the layer with the button does not move and does not overlap the input fields, as on the screenshots

    1 answer 1

    I looked at how my problem with FrameLayout on en.SO was solved. In general, changed layers and property in the manifest:

     <?xml version="1.0" encoding="utf-8"?> 

     <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar_order" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp" android:weightSum="1"> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/til_name_act_order" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/ed_name_act_order" android:hint="Имя" android:textColor="@color/text_color_353535" android:imeOptions="actionNext" android:inputType="text" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Телефон" android:id="@+id/ed_tel_act_order" android:inputType="phone" android:maxLength="17" android:textColor="@color/text_color_353535" android:digits="0,1,2,3,4,5,6,7,8,9" android:imeOptions="actionNext" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Адрес" android:id="@+id/ed_address_act_order" android:textColor="@color/text_color_353535" android:inputType="text" android:imeOptions="actionNext" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Комментарии" android:id="@+id/ed_comment_act_order" android:textColor="@color/text_color_353535" android:inputType="textMultiLine" /> </android.support.design.widget.TextInputLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv_summ_act_order" android:textColor="@color/text_color_353535" android:textSize="18sp" android:text=" Общая сумма: " android:layout_marginTop="4dp" /> </LinearLayout> </ScrollView> </FrameLayout> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom"> <ProgressBar style="?android:attr/progressBarStyle" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/progressBar_act_order" android:visibility="gone" /> <View android:layout_width="match_parent" android:layout_height="@dimen/height_border_line_item" android:background="@color/color_border_item" /> <Button android:text="Оформить" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btn_send_order_act_order" android:background="@drawable/bg_selector_order" android:textColor="@drawable/btn_order_text_color" /> </LinearLayout> 

    The manifesto did this:

     <activity android:name=".activities.OrderScreenActivity" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="stateHidden|adjustPan"/> 

    This is a bit strange, since adjustPan behaves differently than with LinearLayout, if it is a FrameLayout layer