我想在textView中有一些简单的文本。
就像...(android和java)
表示我在textView
中恰好需要"and“符号
如果我在TextView android:text="Bakeries & Dessert"
中用textView
提供,它会在xml中显示错误。
谁能建议我如何忽略特殊字符&,“等,并在我们的TextView
文本中使用它们。
发布于 2011-05-04 16:12:12
尝试通过代码设置文本
TextView tv = (TextView)findViewById(R.id.textview);
tv.setText("input");
使用Html对文本进行编码/解码
Html.fromHtml(string)
发布于 2011-05-04 16:08:49
布局文件只是xml,&符号本身是不允许的。
您将需要改用&
发布于 2016-09-19 19:53:35
使用以下命令:
< for <
> for >
& for &
示例:
<string name="lessthan"> < teste ></string>
<string name="link"> Puzzles & code </string>
https://stackoverflow.com/questions/5880338
复制相似问题