net*_*ein 13
使用\n打破行.
例:
TextView t = findViewById(R.id.text);
t.setText("This is the first line\nThis is the second line\nThird line...");
Run Code Online (Sandbox Code Playgroud)
<?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>
Run Code Online (Sandbox Code Playgroud)
所以你可以像这样引用它:
android:text="@string/text_with_paragraphs"
Run Code Online (Sandbox Code Playgroud)
参考:http://www.experts-exchange.com/Programming/Smartphones/Android/Q_27925834.html
| 归档时间: |
|
| 查看次数: |
34460 次 |
| 最近记录: |