Android自定义键盘出现一半

时间:2017-12-23 06:21:03

标签: android keyboard android-custom-keyboard

键盘显示已满,但出于某些原因,最后两行被隐藏了。我试图从XML更改键盘高度,但它没有帮助。

enter image description here

键盘布局:

<?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>

1 个答案:

答案 0 :(得分:0)

检查日志后,我发现以下错误:

  

E /键盘:解析   错误:android.content.res.Resources $ NotFoundException:File   来自可绘制资源ID的res / drawable / ic_backspace_24dp.xml

     

0x7f0703ae

我替换了文件,一切都恢复了正常。