简体   繁体   English

如何在Android Keyboard XML中使用Unicode?

[英]How can I use Unicode in Android Keyboard XML?

According to Keyboard.Key android:codes , android:keyLabel , and android:keyOutputText , I can use Unicode in these fields. 根据Keyboard.Key android:codesandroid:keyLabelandroid:keyOutputText ,我可以在这些字段中使用Unicode。

May be a string value, using '\\;' 可能是字符串值,使用'\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; 将Unicode字符转义为'\\ n'或'\\ uxxxx'等字符;

In my code, I have tried 在我的代码中,我尝试了

<Key android:codes="\\u2460;" android:keyLabel="\\u2460;"/>
<Key android:codes="\\u2460" android:keyLabel="\\u2460"/> <!-- no semi -->

Which didn't work. 哪个没有用。 So then I tried 所以我尝试了

<Key android:codes="\u2460" android:keyLabel="\u2460"/> <!-- no double slash -->

This worked but only for the keyLabel . 这有效,但仅适用于keyLabel Neither codes nor keyOutputText cause anything to be outputted. codeskeyOutputText都不会导致任何输出。

I even tried moving it over to strings.xml 我什至尝试将其移至strings.xml

<string name="one">\u2460</string>

Which again only works for the keyLabel . 再次仅适用于keyLabel

How do I get this to output what I want? 我如何得到这个输出我想要的?

Note : For those curious, 2460 is an encircled one. 注意 :对于那些好奇的人, 2460是一个被包围的人。

Documentation uses single quotes '\\\①;' 文档使用单引号'\\\①;' you are using double quotes "\\\①;" 您正在使用双引号"\\\①;" .

Disclaimer: I have no idea if that will help as I have not tried but I thought I should mention it 免责声明:我不知道这是否会有所帮助,因为我没有尝试过,但我想我应该提一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM