在 Android 中创建新键盘

Creating a new Keyboard in Android

我正在尝试为 Android 创建一个非罗马键盘。非罗马的意思是字符将是 Android 不支持的不同符号(对于藏文)。 我的问题:是否可以创建一个在整个 Android 期间都受支持的键盘?如果我切换到这个键盘,我就可以在任何应用程序中用这种特定的语言书写或写笔记等。 在 iOS 中是可能的,但我在 Android 中没有看到它。

我正在查看 http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615 他们定义键的地方:

 <Row>
        <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
        <Key android:codes="50" android:keyLabel="2"/>
        <Key android:codes="51" android:keyLabel="3"/>
        <Key android:codes="52" android:keyLabel="4"/>
        <Key android:codes="53" android:keyLabel="5"/>
</Row>

如果不是罗马字符,如何定义按键?另外我应该能够连接一些定义字符的字体类型,我在哪里做的?

谢谢

是的,您可以将自己的键盘应用程序设置为系统默认应用程序,很多应用程序已经在这样做,例如 Swype or Swiftkey

Here is a guide为此。最相关的部分是manifest文件,它告诉Android你的应用程序提供了键盘服务,你可以在设置.[=22中将其设置为你自己的键盘=]

更新:

android:codesXML属性,根据documentation表示:

The unicode value or comma-separated values that this key outputs.

May be a string value, using '\;' to escape characters such as '\n' or '\uxxxx' for a unicode character.

May be an integer value, such as "100".

所以你应该使用 Unicode 字符选项。例如,匈牙利字母 ő 可以通过 \u0151 实现。要找出你需要的 Unicode 字符,你可以使用 this online service.