How to display cursor at the end of text in TextView?

前端 未结 4 1191
一整个雨季
一整个雨季 2021-02-09 18:51

I wanted to display blinking cursor at the end of the text in TextView .

I tried by android:cursorVisible=\"true\" in TextView But no go .

Even i t

4条回答
  •  盖世英雄少女心
    2021-02-09 19:01

    I think you should go for EditText. You can set its background and make it appears like TextView with below code.

    Step 1

    
    
    

    Step 2

    EditText edt = (EditText) findViewById(R.id.edtText);
    edt.setSelection(edt.getText().length());
    

    Output

    enter image description here

提交回复
热议问题