【发布时间】:2019-10-05 22:57:20
【问题描述】:
我正在尝试在 Xamarin Forms 应用程序中构建一个自定义键盘,该键盘使用 Unicode 符号而不是标准 ASCII 布局,但是当我按下键盘上的相应按钮时,这些符号不会显示在标准编辑器或条目组件中。
我的实现完全基于this Github repo。如果我将此存储库中的原始布局 XML 文件更改为包含我所针对的 Unicode 字符之一,则该特定按钮将不会打印该符号:
<?xml version="1.0" encoding="UTF-8" ?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="8%p"
android:keyHeight="50dp"
android:horizontalGap="1%p"
android:verticalGap="1%p">
<Row android:keyHeight="4dp" android:rowEdgeFlags="top" android:verticalGap="1%p">
<Key android:codes="0" android:keyWidth="100%p" android:keyIcon="@drawable/kb_separator_line" />
</Row>
<Row>
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="left" />
<Key android:codes="0x10D0" android:keyLabel="ა" android:keyWidth="18%p" />
<Key android:codes="30" android:keyLabel="B" android:keyWidth="18%p" />
<Key android:codes="31" android:keyLabel="C" android:keyWidth="18%p" />
<Key android:codes="32" android:keyLabel="D" android:keyWidth="18%p" />
<Key android:codes="33" android:keyLabel="E" android:keyWidth="18%p" />
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="left" />
<Key android:codes="8" android:keyLabel="1" android:keyWidth="18%p" />
<Key android:codes="9" android:keyLabel="2" android:keyWidth="18%p" />
<Key android:codes="10" android:keyLabel="3" android:keyWidth="18%p" />
<Key android:codes="11" android:keyLabel="4" android:keyWidth="18%p" />
<Key android:codes="12" android:keyLabel="5" android:keyWidth="18%p" />
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="left" />
<Key android:codes="13" android:keyLabel="6" android:keyWidth="18%p" />
<Key android:codes="14" android:keyLabel="7" android:keyWidth="18%p" />
<Key android:codes="15" android:keyLabel="8" android:keyWidth="18%p" />
<Key android:codes="16" android:keyLabel="9" android:keyWidth="18%p" />
<Key android:codes="7" android:keyLabel="0" android:keyWidth="18%p" />
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="left" />
<Key android:codes="67" android:keyLabel="DELETE" android:keyWidth="37%p" />
<Key android:codes="66" android:keyLabel="ENTER" android:keyWidth="56%p" />
<Key android:codes="0" android:keyWidth="0dp" android:horizontalGap="2%p" android:keyEdgeFlags="right" />
</Row>
</Keyboard>
请注意<Key android:codes="0x10D0" android:keyLabel="ა" android:keyWidth="18%p" /> 行,其中存在来自格鲁吉亚字母的字母“ა”,其 Unicode 值以十六进制表示。我已经尝试过 android:codes 的十进制值,以及 android:keyLabel 的 '\u' 格式,但无论我做什么,在 Android 上运行此应用程序时都不会显示该符号。
如果我以编程方式将此或任何其他格鲁吉亚符号插入到编辑器或条目中,它就会显示出来,所以我知道我的问题与我的特定 Android 版本或不支持这些符号的平板电脑无关。
我正在使用带有 Android 6.1 的联想 TB-X304L。这可能是什么问题?
【问题讨论】: