繁体   English   中英

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

[英]when i set popup outside touchable to false edit text does not showing keyboard in pop up window

我的活动中有一个 PopupWindow,popupWindow 有编辑文本。 问题是当我将弹出窗口设置为 false 时,编辑文本不会在 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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM