Android - 如何在软键盘出现时调整弹出窗口

标签 android popup soft-keyboard adjustment

without soft keyboard

when soft keyboard shows up

我想在我的布局中复制这种效果。但是在我的布局中,当键盘出现时,我的弹出窗口没有调整。 该设备为我调整了下面的主要 Activity ,而不是弹出窗口。

这是我的 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>

有人可以帮助我吗?

最佳答案

试试这个:
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

关于Android - 如何在软键盘出现时调整弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30211210/

相关文章:

java - Android SSL - 不适用于 API 7

android - 使用openCV库时necessitas中的错误

javascript - 模态弹出 javascript

ios - 如何使用 iOS 获取 UIKeyboard 大小

xamarin - 在Xamarin Forms Shared Project中将return更改为next/done键

windows-phone-7 - Scrollviewer 和 SIP 问题 (WP7.5 Mango)

java - 无法使用android.support.v7.widget.Toolbar

android - Xerces + Gradle = preDexDebug 错误

javascript - CSS3 或 Jquery : popup of a thumbnail image when the thumbnail is hovered over

java - 使用 selenium 自动登录 Web 应用程序