Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 文本视图不显示<;符号_Android_Textview - Fatal编程技术网

Android 文本视图不显示<;符号

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

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 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 <"));