How can you make a custom keyboard in Android?

前端 未结 9 2119
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 04:42

I want to make a custom keyboard. I don\'t know how to do it using XML and Java. The following picture is a model of the keyboard I want to make. It only needs numbers.

9条回答
  •  旧巷少年郎
    2020-11-22 05:09

    Here is a sample project for a soft keyboard.

    https://developer.android.com/guide/topics/text/creating-input-method.html

    Your's should be in the same lines with a different layout.

    Edit: If you need the keyboard only in your application, its very simple! Create a linear layout with vertical orientation, and create 3 linear layouts inside it with horizontal orientation. Then place the buttons of each row in each of those horizontal linear layouts, and assign the weight property to the buttons. Use android:layout_weight=1 for all of them, so they get equally spaced.

    This will solve. If you didn't get what was expected, please post the code here, and we are here to help you!

提交回复
热议问题