I want to write a paragraph as part of my mobile application. How do I go about it?
Use \n to break line.
Example:
TextView t = findViewById(R.id.text);
t.setText("This is the first line\nThis is the second line\nThird line...");
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_with_paragraphs">
Can this contain a lot of text? Can it contain \n a 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 reference to it like:
android:text="@string/text_with_paragraphs"
Reference: http://www.experts-exchange.com/Programming/Smartphones/Android/Q_27925834.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With