Android自定义键盘出现一半

天下之事常成于困约,而败于奢靡。这篇文章主要讲述Android自定义键盘出现一半相关的知识,希望能为你提供帮助。
键盘显示已满,但由于某些原因,最后两行被隐藏。我试图从XML更改键盘高度,但它没有帮助。

Android自定义键盘出现一半

文章图片

键盘布局:
< ?xml version="1.0" encoding="utf-8"?> < Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyHeight="@dimen/key_height" android:keyWidth="10%p" android:verticalGap="10px"> < Row> < Key android:keyEdgeFlags="left" android:keyLabel="q" android:popupCharacters="1" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="w" android:popupCharacters="2" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="e" android:popupCharacters="3?èéê" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="r" android:popupCharacters="4" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="t" android:popupCharacters="5" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="y" android:popupCharacters="6" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="u" android:popupCharacters="7úù?ū" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="i" android:popupCharacters="8" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="o" android:popupCharacters="9??óō" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyEdgeFlags="right" android:keyLabel="p" android:popupCharacters="0" android:popupKeyboard="@xml/popup_keyboard" /> < /Row> < Row> < Key android:horizontalGap="4%p" android:keyEdgeFlags="left" android:keyLabel="a" android:popupCharacters="?á??ā???" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="s" android:popupCharacters="?" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="d" /> < Key android:keyLabel="f" /> < Key android:keyLabel="g" /> < Key android:keyLabel="h" /> < Key android:keyLabel="j" /> < Key android:keyLabel="k" /> < Key android:keyEdgeFlags="right" android:keyLabel="l" /> < /Row> < Row> < Key android:codes="-1" android:isModifier="true" android:isSticky="true" android:keyEdgeFlags="left" android:keyIcon="@drawable/ic_shift_24dp" android:keyWidth="15%p" /> < Key android:keyLabel="z" /> < Key android:keyLabel="x" /> < Key android:keyLabel="c" android:popupCharacters="?" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="v" /> < Key android:keyLabel="b" /> < Key android:keyLabel="n" android:popupCharacters="?" android:popupKeyboard="@xml/popup_keyboard" /> < Key android:keyLabel="m" /> < Key android:codes="-5" android:isRepeatable="true" android:keyEdgeFlags="right" android:keyIcon="@drawable/ic_backspace_24dp" android:keyWidth="15%p" /> < /Row> < Row android:rowEdgeFlags="bottom"> < Key android:codes="-2" android:keyEdgeFlags="left" android:keyLabel="?123" android:keyWidth="15%p" /> < Key android:codes="-10000" android:keyIcon="@drawable/ic_insert_emoticon_24dp" /> < !-- 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/ic_language_24dp" /> < Key android:codes="32" android:isRepeatable="true" android:keyIcon="@drawable/ic_space_24dp" android:keyWidth="35%p" /> < Key android:keyLabel="." android:keyWidth="15%p" android:popupKeyboard="@xml/popup_symbols" /> < Key android:codes="10" android:keyEdgeFlags="right" android:keyIcon="@drawable/ic_next_circle_filled_24dp" android:keyWidth="15%p" /> < /Row> < /Keyboard>

答案检查日志后,我发现以下错误:
E / Keyboard:解析错误:android.content.res.Resources $ NotFoundException:来自可绘制资源ID的文件res / drawable / ic_backspace_24dp.xml
0x7f0703ae
【Android自定义键盘出现一半】我替换了文件,一切都恢复正常。

    推荐阅读