本文介绍了如何在 EditText 中设置光标位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有两个EditText
,在加载页面时在第一个EditText中设置了一个文本,所以现在光标将在EditText
的起始位置,我想在不包含数据的第二个 EditText 中设置光标位置.如何做到这一点?
There are two EditText
,while loading the page a text is set in the first EditText, So now cursor will be in the starting place of EditText
, I want to set cursor position in the second EditText which contains no data. How to do this?
推荐答案
position是int:
Where position is an int:
editText1.setSelection(position)
这篇关于如何在 EditText 中设置光标位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!