-1

How to show the text in emulator as we need it using text view? I am writing a code inside android:text element in textview.I want that the code must be shown exactly like how i want it to be means i want to break line when i need so how to do this?

  • 2
    http://stackoverflow.com/questions/2840608/how-do-i-add-a-newline-to-a-textview-in-android – LKHO Sep 23 '16 at 17:36

1 Answers1

2

I think CDATA xml might be the thing you are looking for. Something like

<string name="the_text">
        <![CDATA[
           ... some text <br/>
           ... some text <br/>
        ]]>
</string>

You can also achieve the same without CDATA but with "\n"

<string name="the_text">"...some text \n ...some text \n"</string>

mind the double quotes, without which the line breaks wont happen.

Sachin Murali G
  • 575
  • 6
  • 25