如何在Android中创建新行?

时间:2014-02-19 10:22:28

标签: android newline

我正在开发一个android项目。我想使用/n创建一个新段落。但我没有得到预期的结果。有没有其他方法来创建一个新的线?

我的代码如下

tv.setText("Some of the symptoms of cataract include:/n1.Cloudy, blurry or foggy vision/n2. Development of short-sightedness in older people/n3. Seeing colors differently./n3. Problems with glare during the day or night/n4. Double vision/n5. Sudden changes in prescription of glasses");

3 个答案:

答案 0 :(得分:7)

请改用\n。你的斜线是错误的方向。它必须是 back 斜杠。

答案 1 :(得分:4)

\n此时在文字中插入换行符。

因此,请使用\n代替/n

答案 2 :(得分:2)

试试这个:)

System.getProperty("line.separator")

例如:

TextView textView=(TextView)findViewById(R.id.textView1);
        textView.setText("Hello"+System.getProperty("line.separator")+"World!!!");