我想使TextView中的文本不完整:
这是我在字符串中的值:

<string name="coords2">Lat: %1$.2f %c\nLon: %2$.2f\n(%3$.0fm)</string>

但是当我建立一个apk时,我看到了:
Error:(764) Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
Error:(764) Unexpected end tag string

最佳答案

您好,您可以使用此打印该字符

 TextView tvIn;
 String spcialCharacter="Lat: %1$.2f %c\\nLon: %2$.2f\\n(%3$.0fm)";
 tvIn=(TextView)findViewById(R.id.tvIn);
 tvIn.setText(Html.fromHtml(spcialCharacter));

关于java - Java android以非位置格式指定的多个替换;您是要添加formatted =“false”属性吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44237327/

10-10 19:34