选择里面的EditText的所有文字,当它获得焦点 [英] Select all text inside EditText when it gets focus

查看:169
本文介绍了选择里面的EditText的所有文字,当它获得焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有它的一些虚拟文本一个EditText。当用户点击它,我希望它被选中,所以当用户开始输入的虚拟文本被删除了。

I have an EditText with some dummy text in it. When the user clicks on it I want it to be selected so that when the user starts typing the dummy text gets deleted.

我怎样才能做到这一点?

How can I achieve this?

推荐答案

您可以在的main.xml 文件试试:

android:selectAllOnFocus="true"

这篇关于选择里面的EditText的所有文字,当它获得焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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