自定义键盘

时间:2015-06-11 14:15:45

标签: android android-layout

我想为我的应用创建 自定义键盘 ,可以更改 键盘布局 图1 图2 ,用户无法通过手机设置更改键盘。

enter image description here

图。 1

enter image description here

图。 2

2 个答案:

答案 0 :(得分:2)

根据this article from Android Developer,您可以通过提供切换键(例如全球形语言图标)作为键盘的一部分,允许用户在多个IME子类型之间轻松切换。这样做可以大大提高键盘的可用性,并有助于避免用户受挫。要启用此类切换,请执行以下步骤:

<input-method xmlns:android="http://schemas.android.com/apk/res/android"
                android:settingsActivity="com.example.softkeyboard.Settings"
                android:icon="@drawable/ime_icon"
                android:supportsSwitchingToNextInputMethod="true">
  1. 在输入法的XML资源文件中声明supportsSwitchingToNextInputMethod =“true”。您的声明应与此
  2. 上方的代码段类似
  3. 调用shouldOfferSwitchingToNextInputMethod()方法。
  4. 如果方法返回true,则显示切换键。
  5. 当用户点击切换键时,调用switchToNextInputMethod(),将false传递给第二个参数。值false表示系统平等对待所有子类型,无论它们属于哪种IME。指定true需要系统在当前IME中循环子类型。
  6. 有了这个,我认为用户可以在不进行手机设置的情况下更改键盘布局

    示例:https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/

答案 1 :(得分:0)

我们专门为我们的应用程序创建了一个键盘,但您确实需要1)安装应用程序,2)转到Settings-&gt; Input Type - &gt;键盘并选择要使用的键盘。

以下是github上键盘的链接:

https://github.com/techartist/MultiLanguageKeyboard

不确定你能做你所要求的。根据这个链接:

Switch android keyboard profile programmatically

......这是不可能的。

相关问题