在“警报"对话框中单击“确定"后,从所有“编辑文本"中移出焦点 [英] Remove focus from all Edit Text after click on OK from Alert Dialog

查看:69
本文介绍了在“警报"对话框中单击“确定"后,从所有“编辑文本"中移出焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的活动包含三个EditText和一个按钮.我设置了自定义AlertBox以便在一个EditText上获取User输入.当我从警报"框中单击确定"按钮时,焦点"将自动转到第一个EditText".

My Activity contain three EditText and one button. I set custom AlertBox for get the User input on one EditText. When I click on OK button from Alert Box , Focus Automatically goes to First EditText.

我用过

editext.clearFocus();

我也尝试过

editText.clearFocus();
editText.setEnabled(false);

但是不起作用.
单击AlertDialog中的确定"后如何在所有EditText中删除焦点.预先感谢.

But doesn't work.
How to remove focus in All EditText after click on OK from AlertDialog. Thanks in Advance.

推荐答案

清除焦点并从editText中删除光标

To clear focus and remove cursor from editText

editText.clearFocus();
editText.setFocusable(false);
editText.setFocusableInTouchMode(true);
editText.setCursorVisible(false);

这篇关于在“警报"对话框中单击“确定"后,从所有“编辑文本"中移出焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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