Fixed background, no resize when keyboard is activated

2

I have the following color layout, set to background of LinearLayout :

background.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:angle="270"
        android:centerColor="#7cf1db"
        android:endColor="#831f51"
        android:startColor="#038068"
        android:type="linear" />
</shape>

Result:

ButwhenanEditTextisselectedandthekeyboardispressed,thebackgroundcolor"goes up":

Iwouldliketoleavethisbackgroundfixed,withoutthis"resizing" when opening the keyboard.

    
asked by anonymous 07.02.2018 / 12:43

1 answer

2

For the keyboard not to modify its layout, use the following flag in your Manifest.xml :

<activity android:windowSoftInputMode="adjustPan">
  

adjustPan - The main activity window is not resized to make room for the on-screen software keyboard. Instead, it automatically moves the contents of the window so that the current focus is never overlaid by the keyboard and users can always see what they type. Typically, this behavior is less desirable than resizing because the user may need to close the software keyboard to access and interact with the overlapping parts of the window.

See this and other flags for the keyboard in the documentation officer .

    
07.02.2018 / 17:52