开发者

how to set Edit Textbox cursor start to some default position?

开发者 https://www.devze.com 2023-03-14 14:42 出处:网络
im using a edittext box drawable where the border is little graphical like it has two line border.the thing is if i enter the text its overlapping with t开发者_高级运维he edge of the box.how can i cre

im using a edittext box drawable where the border is little graphical like it has two line border.the thing is if i enter the text its overlapping with t开发者_高级运维he edge of the box.how can i create a space/ gap in the beginning,so that i can enter the text after 1/2 spaces gap from the left end.

Thanks


EditText editText = (EditText) findViewById(R.id.textId);
editText.setText("EditText component");
editText.setSelection(3);  

try this code to set cursor to position 3.

If you just want to add space at strting try adding paddingLeft attribute in your code.

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号