首页 > 解决方案 > 如何在 android 的 KeyBoardView 中设置行的重力?

问题描述

我正在使用 android KeyboardView[android.inputmethodservice.KeyboardView] 制作自定义键盘。一切正常,除非我试图减小键的宽度。

问题是:在这里我无法使底行重力居中

在此处输入图像描述

这背后的代码是:

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyWidth="10%p"
    android:horizontalGap="0px"
    android:verticalGap="0px"
    android:keyHeight="60dp">


    <Row android:rowEdgeFlags="bottom">
        <Key android:keyLabel="," android:keyWidth="5%p"  android:codes="44"/>
        <Key android:keyLabel="/" android:keyWidth="5%p"  android:codes="47"/>
        <Key android:keyLabel="SPACE" android:keyWidth="40%p" android:isRepeatable="true" android:codes="32"/>
        <Key android:keyLabel="DEL" android:keyWidth="10%p" android:isRepeatable="true" android:codes="-5"/>
        <Key android:keyLabel="DONE" android:keyWidth="10%p"  android:codes="-4"/>
    </Row>

</Keyboard>

那么,有什么办法可以使这一行的重心居中?

标签: javaandroidlayoutkeyboardandroid-keypad

解决方案


推荐阅读