Android 文本视图不显示<;符号
TextView不显示Android 文本视图不显示<;符号,android,textview,Android,Textview,TextView不显示使用HTML实体HTML编码 从android.text.TextUtils中尝试htmlEncode() TextUtils.htmlEncode("My String with <"); [编辑] 您询问了在通过资源XML中的ID检索TextView之后必须如何继续。您可以将其文本设置为: TextView t=(TextView)findViewById(R.id.textView); t.setText(TextUtils.htmlEncode("My HT
使用HTML实体
HTML编码
从android.text.TextUtils中尝试htmlEncode()
TextUtils.htmlEncode("My String with <");
[编辑]
您询问了在通过资源XML中的ID检索TextView之后必须如何继续。您可以将其文本设置为:
TextView t=(TextView)findViewById(R.id.textView);
t.setText(TextUtils.htmlEncode("My HTML encoded String with <"));
TextView t=(TextView)findViewById(R.id.TextView);
t、 setText(TextUtils.htmlEncode(“我的HTML编码字符串,带Hi,我在哪里使用文本视图id.@Sudanshu:你是什么意思?你想通过代码还是在布局XML文件中设置文本视图的文本?如果你想在XML文件中设置文本,请尝试转义”@das_weezuli,我实际上想尝试这两种方法,我编写了android:text=“\\@Sudanshu:更新了我的答案。这回答了你的问题吗?嗨,对不起,你可以在下面的场景中解释TextView t=(TextView)findViewById(R.id.TextView);现在我在完成id后该怎么办。
TextView t=(TextView)findViewById(R.id.textView);
t.setText(TextUtils.htmlEncode("My HTML encoded String with <"));