この質問をする前に、私はすでに数時間かけてさまざまな方法を検索して試しましたが、これは答えられなかったこの質問とまったく同じです。質問を複製するつもりはありませんが、ショックを受けました。この問題は解決されず、SOに記録されません。これは、この要件が非常に一般的であるためです。
この問題は100%再現可能です。EditTextを含むレイアウトでPopupWindowを作成し、EditTextを長押しすると、システム編集ダイアログが表示されません。表示方法が原因でダイアログであることがわかります。それがバグなのか、PopupWindowでEditTextを正しく機能させるためにオンにする必要のあるスイッチがあるのかわかりません。
でlayout/popupwindow.xml
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
<EditText android:id="@+id/etText" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
活動中:
PopupWindow pw = new PopupWindow(getLayoutInflater().inflate(R.layout.popupwindow, null), ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
pw.setFocusable(true);
pw.setBackgroundDrawable(new BitmapDrawable());
pw.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0);
何か案は?