Android 编辑文本 : select all text while touch and clear when user starts typing.

标签 android android-edittext

我的应用程序中有一个编辑文本。当用户触摸编辑文本时,整个文本应该被选中,当他开始输入文本时,文本应该被清除。一个例子是浏览器地址栏。有什么办法吗?请帮助我。

最佳答案

您可以使用

选择 EditText 中的所有文本

android:selectAllOnFocus还有setSelectAllOnFocus(boolean)

关于Android 编辑文本 : select all text while touch and clear when user starts typing.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13486405/

相关文章:

android - 按回隐藏软键盘

android - Eclipse - 使用 Google 云打印从应用程序打印报告

android - 如何过滤EditText的输入?

Android EditText 总是从底部填充

android - 如何找到android设备的LAN ip地址?

android - 在 edittext 中为用户 ID 显示带有文本和数字的键盘

android - 在android中倾斜显示edittext

android - 我怎样才能像这样解析这个 JSONArray/JSONObject?

android - Activity 的 onCreate 中出现 NullPointerException

android - Kitkat 不返回 requestFocusNodeHref 的 url