我正在尝试在 TextView 中打印新行。我正在使用字符串 <string name="newl">\n</string>
在我的 strings.xml 文件中。
我想在 output.setText(new StringBuilder().append(output.getText()).append(R.string.newl2).append(input.getText()));
中使用新行
但它不是换行而是显示“2131099673”
我正在使用 android studio,并且正在 xperia z2 上进行调试
最佳答案
试试这个
output.setText(new StringBuilder().append(output.getText()).append(output.getResources().getString(R.string.newl2)).append(input.getText()));
关于Java:strings.xml 中的换行符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32570951/