Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当我将弹出窗口设置为外部可触摸时,错误编辑文本不会在弹出窗口中显示键盘_Android_Android Popupwindow - Fatal编程技术网

Android 当我将弹出窗口设置为外部可触摸时,错误编辑文本不会在弹出窗口中显示键盘

Android 当我将弹出窗口设置为外部可触摸时,错误编辑文本不会在弹出窗口中显示键盘,android,android-popupwindow,Android,Android Popupwindow,我的活动有一个弹出窗口,弹出窗口有编辑文本。问题是,当我将弹出窗口设置为外部可触摸时,错误编辑文本不会在android中打开弹出窗口中的键盘,我通过在弹出窗口中提供取消按钮来关闭弹出窗口。请帮忙,谢谢 LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); final View popupView = inflate

我的活动有一个弹出窗口,弹出窗口有编辑文本。问题是,当我将弹出窗口设置为外部可触摸时,错误编辑文本不会在android中打开弹出窗口中的键盘,我通过在弹出窗口中提供取消按钮来关闭弹出窗口。请帮忙,谢谢

 LayoutInflater inflater = (LayoutInflater)
                    getSystemService(LAYOUT_INFLATER_SERVICE);
            final View popupView = inflater.inflate(R.layout.repeat, null);
            int width = LinearLayout.LayoutParams.MATCH_PARENT;
            int height = LinearLayout.LayoutParams.WRAP_CONTENT;
            boolean focusable = false; 
            final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable);

            // show the popup window
            // which view you pass in doesn't matter, it is only used for the window tolken
            popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
            final LinearLayout until = popupView.findViewById(R.id.Until);
            Button pop_done = popupView.findViewById(R.id.pop_done);
            Button pop_cancel = popupView.findViewById(R.id.pop_cancel);
            dropdown = popupView.findViewById(R.id.spinner);
            final EditText repetition = popupView.findViewById(R.id.repeat_times);
  • 试试这个

    LayoutInflater inflater = (LayoutInflater)
                    getSystemService(LAYOUT_INFLATER_SERVICE);
            final View popupView = inflater.inflate(R.layout.repeat, null);
            int width = LinearLayout.LayoutParams.MATCH_PARENT;
            int height = LinearLayout.LayoutParams.WRAP_CONTENT;
            final PopupWindow popupWindow = new PopupWindow(popupView, width, height);
            popupWindow.setFocusable(true);
            popupWindow.update();
            // show the popup window
            // which view you pass in doesn't matter, it is only used for the window tolken
            popupWindow.showAtLocation(v, Gravity.CENTER, 0, 0);
            popupWindow.setOutsideTouchable(false);
            final LinearLayout until = popupView.findViewById(R.id.Until);
            Button pop_done = popupView.findViewById(R.id.pop_done);
            Button pop_cancel = popupView.findViewById(R.id.pop_cancel);
            Spinner dropdown = popupView.findViewById(R.id.spinner);
            final EditText repetition = popupView.findViewById(R.id.repeat_times);
    

当单击EditExt未运行时,您需要添加InputMethodManager尝试..我更新我的答案请检查。编辑文本正在运行,但我希望避免在触摸外部时弹出关闭…我将focusable设置为false…我可以避免关闭弹出…但edittext不会显示键盘…为什么要执行focusable false?这是另一回事可触摸且可聚焦。嘿,谢谢你的解决方案…但我尝试了使用match parent的布局并保持透明背景…在该布局内,我使用重心弹出窗口…在这种情况下,将弹出整个match parent。。。