Android - How to adjust a popup when the soft keyboard shows up
Asked Answered
G

2

5

without soft keyboard

when soft keyboard shows up

I want to replicate this effect in my layout. But in my layout when the keyboard show up, my pop-up is not adjusted. The device adjust me the main activity below and not the popup.

this is my popup layout.xml :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/sfondo_semi_trasparente_scuro">




<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@color/white"
    android:orientation="vertical">





    <EditText
        android:id="@+id/textNomeGiocatoreNewTeam"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:hint="Nome giocatore"/>


    <EditText
        android:id="@+id/textNumeroMagliaGiocatoreNewTeam"
        android:inputType="number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Numero Maglia"/>

    <Button
        android:id="@+id/buttonConfirmAddNewPlayer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Aggiungi giocatore"
        android:layout_gravity="center"/>


</LinearLayout>

Can someone help me?

Guerdon answered 13/5, 2015 at 9:47 Comment(2)
Try to use : popupWindow.setFocusable(true);Tantalize
I use it.. If i don't use it, the keyoboard don't shows up when i click in the EditText..Guerdon
S
10

Try instead this:
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Scalise answered 13/5, 2015 at 10:8 Comment(1)
It helps me :-DEzmeralda
Q
1

You can also add this to your AndroidManifest.xml

    <activity
        ...
        android:windowSoftInputMode="adjustResize"
    </activity>
Quagmire answered 2/8, 2016 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.