Android:按钮名称中的特殊字符
如何在按钮文本名称中使用特殊字符,如希腊/拉丁字母、较长的破折号等?在下面的示例中,我想用特殊字符替换android:text=“1234”中的1234Android:按钮名称中的特殊字符,android,button,Android,Button,如何在按钮文本名称中使用特殊字符,如希腊/拉丁字母、较长的破折号等?在下面的示例中,我想用特殊字符替换android:text=“1234”中的1234 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_h
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1234" />
</LinearLayout>
您可以在字符串中使用\u
作为前缀
“Ά”
=(char)0x0386
=“\u0386”
你试过什么了吗?显示您的代码“按钮名称”是什么意思?是android:text
还是android:id
只需将文本粘贴到代码/xml资源文件中即可。只要文件以UTF-8编码,它就可以正常工作。