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

前端 未结 4 1192
一整个雨季
一整个雨季 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:03

    Finally Fixed this Using the EditText as per @Chintan Rathod advice.

     //reference to @Chintan Rathod.
    

    Code

    EditText text=(EditText) findViewById(R.id.text);
    text.setText("hello");
    text.setSelection(text.getText().length()); // reference to @Umer Farooq code.
    

提交回复
热议问题