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
Use TextView
inside a ScrollView
to display messages with any no.of lines. User can't edit the text in this view as in EditText
.
I think this is good for your requirement. Try it once.
You can change the default color and text size in XML file only if you want to fix them as below:
or if you want to change dynamically whenever you want use as below:
TextView textarea = (TextView)findViewById(R.id.tv); // tv is id in XML file for TextView
textarea.setTextSize(20);
textarea.setTextColor(Color.rgb(0xff, 0, 0));
textarea.setTypeface(Typeface.SERIF, Typeface.ITALIC);