3

我一直在搞乱自定义键盘,但无法实现我想要的。

我尝试遵循各种教程(例如这个How can I implement special soft keyboard)但无法构建自己的键盘,因为总是缺少某些部分。

我还尝试了 API 10 示例附带的示例 SoftKeyboard,但布局不适合我的应用程序。

现在,我想要的是一个默认的 android 4.3 软键盘,而不是提供切换到左下角的数字视图的选项(我指的是?123按钮),而是在顶部添加另一行键。该行应包含键“0”到“9”。

有人可以帮我吗?我真的很感激!

4

1 回答 1

2

Adding extra row to the android default keyboard is not possible for this you have to go to the custom keyboard..Custom keyboard is not much difficult to understand here is the best example of android custom keyboards..

1.Custom keyboard example-1

2.Custom keyboard example-2

Once go to the xml file in the res/xml folder and define keys whatever you want..and no of rows and columns for keyboard..

In your layout definig the keyboardview set android:keyBackground="@drawable/keyboardview_selector" color whatever you want..

 <android.inputmethodservice.KeyboardView
            android:id="@+id/keyboardview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="10dp"
            android:background="@android:color/transparent"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:keyBackground="@drawable/keyboardview_selector" />
于 2013-10-23T10:37:14.163 回答