Android将unicode字符串设置为textview
我可以通过Android将unicode字符串设置为textview,android,unicode,Android,Unicode,我可以通过xmllayout上的text属性将Unicode字符/字符串设置为TextView,如下所示: android:text="" 但是我不能像这样从java代码中设置Unicode: icon_notify_post_message.setText(""); ”;“是我从中找到的图标,当我尝试从xml布局设置它时,它唯一起作用,当我尝试设置它时,它不起作用是从java代码将unicode保存在String.xml中,并使
xml
layout上的text
属性将Unicode字符/字符串设置为TextView,如下所示:
android:text=""
但是我不能像这样从java代码中设置Unicode:
icon_notify_post_message.setText("");
”;“
是我从中找到的图标,当我尝试从xml布局设置它时,它唯一起作用,当我尝试设置它时,它不起作用是从java代码将unicode保存在String.xml中,并使用一些名称。然后,要在textView
中进行设置,请使用以下命令:
icon_notify_post_message.setText(getstring(//your string)).
这是在textView
中使用unicode的推荐标准方式。
或者一种非常常见的方法(我使用的方法):
设置text string.xml文件并访问text您需要先将字体设置为TextView。@谢谢,问题已解决
String str = "\u00C7" + getContext().getString(R.string.your_string);
Entering the text as HTML in java:
yourTextView.setText(Html.fromHtml("your chars"));