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?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Remember call
requestFocus()
beforesetSelection
for edittext.I believe the most simple way to do this is just use padding.
Say in your xml's edittext section, add android:paddingLeft="100dp" This will move your start position of cursor 100dp right from left end.
Same way, you can use android:paddingRight="100dp" This will move your end position of cursor 100dp left from right end.
For more detail, check this article on my blog: Android: Setting Cursor Starting and Ending Position in EditText Widget
Let editText2 is your second EditText view .then put following piece of code in onResume()
or put
in your xml layout of the second EditText view.
If you want to set the cursor after
n
character from right to left then you have to do like this.If edittext's text like
and you want to move cursor at 6th position from right
Then it will move the cursor at-
use the below line
e2
is edit text Object Name