数据库的GetString时: n出现在字符串不是funcional
inf = c.getstring(5);
//inf is equals "Hello how are you?\nFine and you\nI am fine, thanks.";
当我打印它似乎以同样的方式和不执行参数“\ n”:
tV1.setText(inf);
//the text "is Hello how are you?\nFine and you\nI am fine, thanks."
但我想:
"Hello how are you?
Fine and you
I am fine, thanks."
什么问题?
该解决方案对我来说:
String finalInf = inf.replace("\\n", System.getProperty("line.separator"));
tV1.setText(finalInf);
感谢:Skaard-Solo和休息。
没有工作,我试过String finalInf = inf.replace(“\\\ n”,System.getProperty(“line.separator”));和字符串finalInf = inf.replace(“\ n”,System.getProperty(“line.separator”));但没有.. :( –
您是否在android xml布局中设置了maxLine?(并使用\\ n) –
最后我使用String finalInf = inf.replace(“\\ n”,System.getProperty(“line.separator “));并且工作正常,问题出在”\\\ n“和”\ n“不正确,正确的是”\\ n“ - >谢谢 –