Space between Edittext and android keyboard

6

I wonder if it's possible to put a margin to space the edittext keyboard so it does not look this close:

ThexmlofhowIamdeclaringtheEditText:

<EditTextandroid:id="@+id/editTextNome"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_marginLeft="23px"
        android:layout_marginRight="23px"
        android:paddingLeft="7dp"
        android:layout_marginBottom="40dp"
        android:hint="@string/nome_login"
        android:inputType="textCapSentences"
        android:background="@drawable/rounded_border"/>
    
asked by anonymous 14.05.2017 / 23:41

2 answers

3

You've already tried to android: windowSoftInputMode as your next activity :

android:windowSoftInputMode="adjustResize"

or

android:windowSoftInputMode="adjustPan"

By definition, according to the documentation,

  

adjustResize : The main activity window is always resized to make room for the on-screen software keyboard.

     

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.

But by context, I believe that in your case adjustResize works, if it does not work, arrow in activity android:windowSoftInputMode="adjustPan" , along with android:paddingBottom in EditText , with the value you deem necessary and arrow too: android:gravity="bottom" .

    
14.05.2017 / 23:57
0

Thanks @Mathias, adjustResize worked fine, it looks like the whole xml field has been used if it serves as a reference for someone:

in the manifest file:

<activity android:name=".MainActivity" android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

and in the activity xml:

<LinearLayout
    android:id="@+id/menu_login"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="100dp"
    android:orientation="vertical"
    android:visibility="invisible"
    android:layout_marginBottom="35dp">
    <EditText
        android:id="@+id/editTextNome"
        android:layout_width="match_parent"
        android:layout_marginLeft="20px"
        android:layout_marginRight="20px"
        android:paddingLeft="5dp"
        android:layout_marginBottom="35dp"
        android:hint="@string/nome_login"
        android:layout_height="40dp"
        android:inputType="textCapSentences"
        android:background="@drawable/rounded_border"
    />
    <Button
        android:id="@+id/botaoEntrar"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:text="@string/botao_entrar"
        android:elevation="0dp"
        android:background="@drawable/rounded_button"
        android:textColor="@color/white"
        android:onClick="abrirFicha"
    />
</LinearLayout>
    
15.05.2017 / 05:45