【问题标题】:How can I use Unicode in Android Keyboard XML?如何在 Android 键盘 XML 中使用 Unicode?
【发布时间】:2018-07-16 20:58:56
【问题描述】:

根据 Keyboard.Key android:codesandroid:keyLabelandroid:keyOutputText,我可以在这些字段中使用 Unicode。

可以是字符串值,使用 '\;'为 unicode 字符转义诸如 '\n' 或 '\uxxxx' 之类的字符;

在我的代码中,我已经尝试过

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

这没有用。所以我尝试了

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

这有效,但仅适用于keyLabelcodeskeyOutputText 都不会导致输出任何内容。

我什至尝试将其移至strings.xml

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

这又只适用于keyLabel

如何让它输出我想要的?

注意:对于那些好奇的人,2460 是一个被圈起来的。

【问题讨论】:

    标签: android xml unicode keyboard escaping


    【解决方案1】:

    文档使用单引号'\\u2460;',您使用的是双引号"\\u2460;"

    免责声明:我不知道这是否会有所帮助,因为我没有尝试过,但我认为我应该提及它

    【讨论】:

      猜你喜欢
      • 2021-08-08
      • 2018-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-27
      • 2012-01-10
      相关资源
      最近更新 更多