-1

I want to set a long text with break line in string.xml
I couldn't insert break line for all

for example:

my text : It is a test 1.It is a test 2. It is a test 3. It is a test 4. . . . It is a test 500. It is a test 501.

I want to change to:
It is a test 1
It is a test 2
It is a test 3
It is a test 4
.
.
.
It is a test 500
It is a test 501

amirmamed
  • 41
  • 6

2 Answers2

2

Insert "\n" where you want your text to jump on next line.

I.e.:

myText = myText.replace(". ", "\n")

in xml layout:

android:text="My very long long\nlong long long long\nlong long text"
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
0

Simply use this

<string name="sample_string"><![CDATA[It is a test 1 <br />It is a test 2]]></string>
Linga
  • 10,379
  • 10
  • 52
  • 104