我为Samsung S8制作了自定义键盘。 keyboard.xml文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<Keyboard n1:keyWidth="13.999998%p" n1:keyHeight="40.0dip" n1:horizontalGap="2.6000023%p" n1:verticalGap="10.0dip"
xmlns:n1="http://schemas.android.com/apk/res/android">
<Row n1:keyHeight="0.100000024px" n1:rowEdgeFlags="top" />
<Row>
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="49" n1:keyEdgeFlags="left" n1:keyLabel="1" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="50" n1:keyLabel="2" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="51" n1:keyLabel="3" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="52" n1:keyLabel="4" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="53" n1:keyLabel="5" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="54" n1:keyLabel="6" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="55" n1:keyLabel="7" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="56" n1:keyLabel="8" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="57" n1:keyLabel="9" />
<Key n1:keyWidth="8.7%p" n1:horizontalGap="1.05%p" n1:codes="48" n1:keyLabel="0" />
</Row>
</Keyboard>
(我省略了其他行,代码中仅包含第一行)。
当我敲击键盘数字时,我没有写“ 1”,“ 2”等,而是得到了ASCII带圆圈的数字,例如“❶”,“❷”等。怎么会这样ASCII码正确(48、49等)。
当然,此错误仅在自定义键盘上发生,而不在Samsung S8默认键盘上发生。
如何解决此问题?