初衷
由于项目需求,当前的设备没有TP,因此系统默认软键盘输入法无法点击输入,考虑0费用下,我将android原生的Soft Keyboard输入法进行了改造,让其可以通过物理按键获取到焦点,从而进行按键输入。
下面是本次修改所作出的全部patch,请参考。
diff --git a/samples/SoftKeyboard/res/xml/qwerty.xml b/samples/SoftKeyboard/res/xml/qwerty.xml
index 936c977..568a4c4 100755
--- a/samples/SoftKeyboard/res/xml/qwerty.xml
+++ b/samples/SoftKeyboard/res/xml/qwerty.xml
@@ -70,17 +70,18 @@
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-3" android:keyIcon="@drawable/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="10%p"/>
+ <Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p"/>
<!--
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
- -->
+
<Key android:codes="-101" android:keyIcon="@drawable/sym_keyboard_language_switch"
android:keyWidth="10%p"/>
+ -->
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:keyWidth="30%p" android:isRepeatable="true"/>
<Key android:codes="46,44" android:keyLabel=". ,"
- android:keyWidth="15%p"/>
+ android:keyWidth="20%p"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:keyWidth="20%p" android:keyEdgeFlags="right"/>
</Row>
diff --git a/samples/SoftKeyboard/res/xml/symbols.xml b/samples/SoftKeyboard/res/xml/symbols.xml
index 225ea08..23848d6 100755
--- a/samples/SoftKeyboard/res/xml/symbols.xml
+++ b/samples/SoftKeyboard/res/xml/symbols.xml
@@ -70,16 +70,17 @@
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-3" android:keyIcon="@drawable/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left" />
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="10%p" />
+ <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" />
<!--
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
- -->
+
<Key android:codes="-101" android:keyIcon="@drawable/sym_keyboard_language_switch"
android:keyWidth="10%p" />
+ -->
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="30%p"
android:isRepeatable="true"/>
- <Key android:codes="44" android:keyLabel="," android:keyWidth="15%p" />
+ <Key android:codes="44" android:keyLabel="," android:keyWidth="20%p" />
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:keyWidth="20%p" android:keyEdgeFlags="right"
/>
diff --git a/samples/SoftKeyboard/res/xml/symbols_shift.xml b/samples/SoftKeyboard/res/xml/symbols_shift.xml
index fa551f2..c3ea4f1 100755
--- a/samples/SoftKeyboard/res/xml/symbols_shift.xml
+++ b/samples/SoftKeyboard/res/xml/symbols_shift.xml
@@ -70,16 +70,17 @@
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-3" android:keyIcon="@drawable/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left" />
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="10%p" />
+ <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" />
<!--
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
- -->
+
<Key android:codes="-101" android:keyIcon="@drawable/sym_keyboard_language_switch