【问题标题】:Android - How to adjust a popup when the soft keyboard shows upAndroid - 如何在软键盘出现时调整弹出窗口
【发布时间】:2015-07-24 12:39:39
【问题描述】:

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

这是我的弹出 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.setFocusable(true);
  • 我使用它.. 如果我不使用它,当我点击 EditText 时键盘不会显示..

标签: android popup soft-keyboard adjustment


【解决方案1】:

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

【讨论】:

  • 它对我有帮助:-D
【解决方案2】:

您也可以将其添加到您的 AndroidManifest.xml

    <activity
        ...
        android:windowSoftInputMode="adjustResize"
    </activity>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-01
    • 2011-02-03
    • 1970-01-01
    • 2015-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    相关资源
    最近更新 更多