This question does not have proper information about what you exactly want.
I can think of 2 possible cases.
CASE 1 : Writing in a new line in Text View.
Hi there
This is a single Text View
If this is what you want, but you get get something like
Hi there This is a single Text View
You can change lines using new line character ‘n’. Place this where the lines need to be changed.
Example:
XML :
- android:layout_width=»wrap_content»
- android:layout_height=»wrap_content»
- android:text=»Hi there nThis is a single Text View» />
This will give you the desired format of the Text.
JAVA :
- TextView textView = findViewbyId(R.id.textView);
- textView.setText(«Hi there nThis is a single Text View»);
Beware that the new line character should be appended with the word (“nHi”) and not with a space (“n Hi”).
CASE 2 : You want to set the maximum number of lines in Text View.
If you want to restrict the maximum number of lines in a text view , you can simply add the
- android:maxLines=»some_positive_integer»
to your Text View.
Example:
- android:layout_width=»wrap_content»
- android:layout_height=»wrap_content»
- android:maxLines=»some_positive_integer»
- android:text=»Hi there nThis is a single Text View» />
Hope this helps.
If this was not required, feel free to ask it with proper example.