How do I stop Keyboard from messing with my layout?

Asked

Viewed 266 times

0

How do I stop the button from moving when editText pulls the Keyboard? Thanks in advance. Botao mudando de sitio

xml of Bhutan:

    <Button
    android:id="@+id/hora_picker"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:text="ESCOLHER HORA"
    android:textStyle="bold"
    android:textSize="25sp"
    android:layout_alignBaseline="@+id/Hora"
    android:layout_alignBottom="@+id/Hora"
    android:layout_toEndOf="@+id/sala" />
  • That button of yours must be with align_bottom, nay?

  • I will edit with the xml button.

  • I don’t think that’s the xml button.

1 answer

1


Declare that line in your Activity within Androidmanifest:

<activity android:name="MyActivity"
    ...
    android:windowSoftInputMode="adjustPan"
    ...
</activity>

As explained by the Android Developer website:

adjustPan: Main activity window is not resized to create space for the software keyboard on the screen. Instead, the window contents automatically so that the current focus is never and users can always see what they type. Normally, this behavior is less desirable than the resizing, as the user may need to close the keyboard software to access and interact with the overlapping parts of the window.

https://developer.android.com/guide/topics/manifest/activity-element.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.