自定义键盘
自定义View实现支付密码的输入
自定义系统键盘
核心:KeyboardView 与自定义键盘文件 xml一起使用实现
province_keyboard = new Keyboard(mContext, R.xml.province_abbreviation);
number_keyboar = new Keyboard(mContext, R.xml.number_or_letters);
xml 部分代码:
xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p" android:keyHeight="8%p"
android:horizontalGap="0.0px" android:verticalGap="0.0px"
>
android:horizontalGap="1%p" android:keyWidth="8%p"
android:keyEdgeFlags="left" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p"
android:keyEdgeFlags="right"/>
android:horizontalGap="1%p" android:keyWidth="8%p"
android:keyEdgeFlags="left" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p"
android:keyEdgeFlags="right" />
android:horizontalGap="11%p" android:keyWidth="8%p"
android:keyEdgeFlags="left"/>
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p"
android:keyEdgeFlags="right" />
android:keyWidth="13%p" android:keyEdgeFlags="left"
android:isModifier="true" android:isSticky="true" />
android:horizontalGap="8%p" android:keyWidth="8%p"/>
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p" />
android:horizontalGap="2%p" android:keyWidth="8%p"/>
android:keyEdgeFlags="right" android:keyIcon="@drawable/remove_edittext_data"
android:horizontalGap="8%p" android:keyWidth="13%p"
android:isRepeatable="true" />
支付自定义键盘是 上下两个自定义View来实现的。比较简单 不多写了。