显示对话框时,活动中的外部edittext未在android中显示软键盘 [英] When Dialog is showing, outside edittext in activity not showing the soft keyboard in android

查看:208
本文介绍了显示对话框时,活动中的外部edittext未在android中显示软键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个严重的问题.我正在进行一项活动,因此有一项编辑文本.我想在该活动的右上方显示一个自定义对话框.现在我的问题是在显示对话框时,当我单击编辑文本时,软键盘没有显示....请帮助我想在对话框显示时显示键盘...我搜索了很多..i找到了对话框内编辑文本的解决方案,但我需要对话框外的编辑文本...请帮助

now i had a severe problem. I am having one activity and in that i have one edit text. I want to show up a customized dialog box on the top right of that activity. Now what my problem is while the dialogue is showing, when i click the edit text, soft keyboard is not showing....please help i want to show the keyboard while the dialog is showing... i have searched many..i found solution for the edit text inside the dialog but i need for the edit text which is outside the dialog...please help

推荐答案

我终于得到了我的问题的答案.

Hi finally i got answer for my question.

objDialogueWindow = objDialogue.getWindow();
objDialog.setOnShowListener(new OnShowListener() {

                @Override
                public void onShow(DialogInterface dialog) {
                    // TODO Auto-generated method stub
                    objDialogWindow.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
                    objDialogWindow.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
                }
            });

这将解决我的问题. 窗口标志:关于此窗口与当前方法的交互方式,反转FLAG_NOT_FOCUSABLE的状态.也就是说,如果设置了FLAG_NOT_FOCUSABLE并且设置了此标志,则窗口的行为就好像它需要与输入方法进行交互,因此被放置在窗口的后面/后面.如果未设置FLAG_NOT_FOCUSABLE且设置了此标志,则窗口的行为就好像它不需要与输入方法进行交互,并且可以放置以使用更多空间并覆盖输入方法. 请参阅 http://developer.android.com/中的说明. reference/android/view/WindowManager.LayoutParams.html#FLAG_ALT_FOCUSABLE_IM

This will solve my problem. Window flag: invert the state of FLAG_NOT_FOCUSABLE with respect to how this window interacts with the current method. That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the window will behave as if it needs to interact with the input method and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is not set and this flag is set, then the window will behave as if it doesn't need to interact with the input method and can be placed to use more space and cover the input method. Please refer the explanation in http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_ALT_FOCUSABLE_IM

这篇关于显示对话框时,活动中的外部edittext未在android中显示软键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆