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

时间:2015-06-08 04:58:57

标签: android android-softkeyboard

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

 <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属性来更改键标签的可见大小。

如何更改密钥标签的大小?

感谢。

1 个答案:

答案 0 :(得分:2)

字符键的文本大小。 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"/>