问题
I want to change the size of the keyboard label in my custom keyboard. The code I am using is like this,
<Keyboard
android:keyWidth="%10p"
android:keyHeight="50px"
android:horizontalGap="2px"
android:verticalGap="2px" >
<Row android:keyWidth="32px" >
<Key android:keyLabel="A" />
...
</Row>
...
So the issue is, if we take the code above the letter 'A'(label) is too small in my keyboard.
In KeyBoard class I can't find any xml attribute to change the visible size of the key label.
How to change the size of the key label?
Thanks.
回答1:
Size of the text for character keys. android:keyTextSize
can help.
Set this in your layout xml file, like this:
<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"/>
来源:https://stackoverflow.com/questions/30701479/how-to-change-the-key-label-size-of-a-custom-keyboard-in-android