Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format long text in strings.xml?

When I have a TextView with a long text, I usually have to leave it in one line which is later very hard to edit. If I use any kind of formatting, like on this image

Then I get an error.

enter image description here

I would like to know how to format such long text into multi-line text without producing errors?

EDIT

I was not precise in my Q. It seems that this can be solved in Eclipse. The problem is IntelliJ IDEA and its formatting command Ctrl+Alt+L which does not pass by compiler in the file strings.xml. The snapshots are from that IDE.

like image 848
sandalone Avatar asked Aug 17 '11 15:08

sandalone


2 Answers

The issue with the code formatter breaking XML text is known and will be fixed in an upcoming version if IJ. At least in the case shown here: http://youtrack.jetbrains.net/issue/IDEA-69506?projectKey=IDEA

like image 179
sylvanaar Avatar answered Oct 13 '22 13:10

sylvanaar


Had the same problem a few weeks back and found that there is no good way to do this. If you want the output text in your app to have multiple lines, you can simply insert "\n" as many times as you want, but if you're talking about it wrapping in the editor only, Eclipse does not support this natively.

However, I did find this: http://ahtik.com/blog/projects/eclipse-word-wrap/

A nice project left over from Google's summer of code a few years ago, it does visual word wrap only so I don't think it will affect the compilation process, which should prevent those errors.

like image 34
Raggedtoad Avatar answered Oct 13 '22 14:10

Raggedtoad