将unicode用于自定义android键盘 [英] Using unicode for a custom android keyboard
本文介绍了将unicode用于自定义android键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为Android应用创建不丹键盘.我正在使用unicode.但是,当我尝试运行该应用程序时,我收到错误消息,提示错误解析键码",并且在按下字母时不显示这些字母.
I am creating a Bhutanese keyboard for an android App. I am using unicode. However, I am getting error messages when I try to run the app that say "error parsing keycode", and the letters do not show up when they are pressed.
这是键盘xml文件的示例:
Here is a sample of the keyboard xml file:
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="60dp">
<Row>
<Key android:codes="U+0F09" android:keyLabel="༉" android:keyEdgeFlags="left"/>
<Key android:codes="U+0F21" android:keyLabel="༡"/>
<Key android:codes="U+0F22" android:keyLabel="༢"/>
<Key android:codes="U+0F23" android:keyLabel="༣"/>
<Key android:codes="U+0F24" android:keyLabel="༤"/>
<Key android:codes="U+0F25" android:keyLabel="༥"/>
<Key android:codes="U+0F26" android:keyLabel="༦"/>
<Key android:codes="U+0F27" android:keyLabel="༧"/>
<Key android:codes="U+0F28" android:keyLabel="༨"/>
<Key android:codes="U+0F29" android:keyLabel="༩"/>
<Key android:codes="U+0F20" android:keyLabel="༠"/>
<Key android:codes="U+0F14" android:keyLabel="༔"/>
<Key android:codes="U+0F0D" android:keyLabel="།"/>
<Key android:codes="U+0F5D" android:keyLabel="ཝ" android:keyEdgeFlags="right"/>
</Row>
我的键盘在使用英语键盘时工作正常,如下所示:
My keyboard workded when it was an english keyboard, like this one:
<Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="119" android:keyLabel="w"/>
<Key android:codes="101" android:keyLabel="e"/>
<Key android:codes="114" android:keyLabel="r"/>
<Key android:codes="116" android:keyLabel="t"/>
<Key android:codes="121" android:keyLabel="y"/>
<Key android:codes="117" android:keyLabel="u"/>
<Key android:codes="105" android:keyLabel="i"/>
<Key android:codes="111" android:keyLabel="o"/>
<Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
</Row>
我不应该对自定义android键盘使用unicode吗?或者,如果可以的话,我该怎么做才能使其正常工作?
Am I not supposed to use unicode for a custom android keyboard? Or if I can, what can I do to make it work?
推荐答案
要解决解析错误,您可以:
To fix the parse error you can either:
- 将"U + 0F09"替换为Unicode的十进制(3849)值.
- 省去android代码.该代码应基于自动生成 在keyLabel中的字符上.我已经用英语测试过 西班牙语字符.
- replace "U+0F09" with the decimal (3849) value of the Unicode.
- leave the android code out. The code should be auto generated based on the character in keyLabel. I've tested this with English and Spanish characters.
这篇关于将unicode用于自定义android键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文