如何设置的EditText光标位置? [英] How to set cursor position in EditText?

查看:96
本文介绍了如何设置的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?

推荐答案

如果位置是一个int:

Where position is an int:

editText1.setSelection(position)

这篇关于如何设置的EditText光标位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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