Android: newline string value in XML

I have a menu item with a slightly long name, be it "My very, very unusual first Android menu item is overpriced!".

Problem: The text is presented on one line and is cut out in the menu area.
But even if the text matches, I still don’t want it to occupy all the space from left to right, and prefer that the line break is somewhere reasonable.

Question: how can I cause a line break in the XML file (values ​​/strings.xml)?
The line is simple:

<item android:id="@+id/MyFirstItem" android:title="My very very, very extremely first android menu item inflated!"/> 

Eclipse rejects everything starting from '<'inside the string, so no-go.
Also, I don't want to leave XML borders.

Thanks in advance

+5
source share
1 answer

It just \ n works for me.

Edit: For general use of XML, you would like to use options such as

            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"

instead of adding your own lines (of course, this does not apply to strings.xml, but for your layout). This is time consuming and can cause your application to look “wrong” on different phones / resolutions. Just in case, you have not used it already, not implying that you are doing something wrong. :)

+4
source

All Articles