How to create a TextArea in Android

前端 未结 11 1851
醉话见心
醉话见心 2021-02-06 22:16

How do I display a TextArea for my android project? From xml, the only choice is TextField, multi lined. But thats editable. I need a TextArea which is only for displaying messa

11条回答
  •  一生所求
    2021-02-06 23:04

    If you do not want to allow user to enter text TextView is the best option here. Any how you can also add EditText for this purpose. here is a sample code for that.

    This would automatically show scrollbar if there is more text than the specified lines.

    
    

    Edit: Adding attributes below to textView would make it a textArea that would not be editable.

    android:lines="8"
    android:maxLines="10"
    android:minLines="6" // optional
    

提交回复
热议问题