Android的:如何以编程方式突出显示的EditText? [英] Android: How to highlight EditText programmatically?
本文介绍了Android的:如何以编程方式突出显示的EditText?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不是requestFocus()
将光标移动到编辑框,但不突出显示。我要强调它像,就好像它被感动。
requestFocus()
moves the cursor to the edit box, but does not highlight it. I want to highlight it like as if it was touched.
我怎样才能做到这一点?
How can I do this?
推荐答案
试试这个:
_field.setSelection( int startIndex, int endIndex);
第一个参数startIndex是要开始凸显字符串中的点和endIndex的参数是要停止突出一点。
The first parameter startIndex is the point in the string where you want to begin highlighting and the endIndex parameter is the point where you want to stop highlighting.
如果您想选择所有的文字用这个来代替:
If you want to select all of the text use this instead:
_field.selectAll();
这篇关于Android的:如何以编程方式突出显示的EditText?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文