获取键盘出现,而无需点击的EditText [英] Getting Keyboard To Appear Without Having To Click on EditText

查看:94
本文介绍了获取键盘出现,而无需点击的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用上AlertDialog自定义布局。自定义布局已提起一个EditText里面我是用得到一个电话。当我显示AlertDialog,为了让键盘键入你必须点击提交的EditText的电话号码。有没有办法让键盘自动弹出,当我调出AlertDialog,使用户不必点击提交的EditText拿到键盘。

I am using a custom layout on an AlertDialog. The custom layout has an EditText filed which I am using to get a phone. When I display the AlertDialog, in order to get the keyboard to type in the phone number you have to click on the EditText filed. Is there a way to get the keyboard to automatically pop up when I bring up the AlertDialog so that the user does not have to click on the EditText filed to get the Keyboard.

谢谢,
人员Prasanna

Thanks, Prasanna

推荐答案

刚加入这一行,当你显示您的对话框:

Just add this line when you are showing your dialog:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

这篇关于获取键盘出现,而无需点击的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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