<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android=“http://schemas.android.com/apk/res/android”
android:keyHeight=“50dp”
android:keyWidth=“25%p” //一行四个按键
android:horizontalGap=“1px” //键盘与键盘间水平方向分割
android:verticalGap=“1px”> //键盘与键盘间垂直方向分割
//数字键1
<Key
android:codes=“50” android:keyLabel=“2”/> //数字键2
//数字键3
//删除键
//数字键4
//数字键5
//数字键6
//确定键,设置较大
//数字键7
//数字键8
//数字键9
//清零键
//0键
//.键
然后是逻辑编写:
KeyboardUtils.java
package com.example.mytally.utils;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.text.Editable;
import android.t