數據庫的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「 - >謝謝 –