Write a paragraph using textview on Android

I want to write a paragraph as part of my mobile application. How can I do it?

+7
source share
3 answers

Use \ n to break a line.

Example:

TextView t = findViewById(R.id.text); t.setText("This is the first line\nThis is the second line\nThird line..."); 
+11
source
 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="text_with_paragraphs"> Can this contain a lot of text? Can it contain \na newline? Yes, it can. Adding a 2nd line like this should work. It should not cause parsing errors. </string> <resources> 

So you can make a link to it as:

 android:text="@string/text_with_paragraphs" 

Link: http://www.experts-exchange.com/Programming/Smartphones/Android/Q_27925834.html

+4
source

It helps me:

 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="text_with_paragraphs"> Can this contain a lot of text? Can it contain \na newline? Yes, it can. Adding a 2nd line like this should work. It should not cause parsing errors. </string> <resources> android:text="@string/text_with_paragraphs" 
0
source

All Articles