Reputation: 397
In my project I need to display the instructions page. The page consists of 8 instructions. So do we need to create 8 textviews to display those instructions? Is it possible to display all those instructions using one single textview?
I read about multi-line textviews.
But for my case can I do so to display all 8 instructions in one textview?
Upvotes: 0
Views: 1994
Reputation: 24021
You can use \n
new line character from string resource or thru code:textView.setText("1st line\n 2nd line");
Upvotes: 2
Reputation: 4928
As far as I recall, the newline character \n is recognised when used in strings.xml, so you could declare your instructions there and reference it in the layout. I never found a way to do it within the layout XML itself, but there may be something.
Edit: for clarity - I mean using the escaped character, e.g.:
<string name="instructions">Line 1\nLine 2</string>
Upvotes: 3
Reputation: 1043
You can use html to format your string: textView.setText(Html.fromHtml("item 1<br>item 2<br>"));
Upvotes: 0