如何在 android 中更改自定义键盘的键标签大小

How to change the key label size of a custom keyboard in android

我想更改自定义键盘中键盘标签的大小。我使用的代码是这样的,

 <Keyboard
     android:keyWidth="%10p"
     android:keyHeight="50px"
     android:horizontalGap="2px"
     android:verticalGap="2px" >
 <Row android:keyWidth="32px" >
     <Key android:keyLabel="A" />
     ...
 </Row>
 ...

所以问题是,如果我们采用上面的代码,字母 'A'(标签)在我的键盘上太小了。

KeyBoard class 中我找不到任何 xml 属性来更改键标签的可见大小。

如何更改按键标签的大小?

谢谢。

字符键的文本大小。 android:keyTextSize 可以提供帮助。

在布局 xml 文件中进行设置,如下所示:

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboard_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:keyBackground="@drawable/key_background"
    android:keyTextColor="@android:color/white"
    android:keyTextSize="20sp"/>