5

我定制了软键盘。但是键盘键(1,2,3,4,5,6,7,8,9,0,. 和 OK)看起来很模糊。删除键很好,但其他键看起来很模糊。

这是我的键盘。 在此处输入图像描述

这是我的自定义键盘 xml 文件

<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="0px"
android:keyHeight="10%p"
android:keyWidth="24%p"
android:verticalGap="0px" >

<Row>
    <Key
        android:codes="49"
        android:keyEdgeFlags="left"
        android:keyLabel="1" />
    <Key
        android:codes="50"
        android:keyLabel="2" />
    <Key
        android:codes="51"
        android:keyLabel="3" />
    <Key
        android:codes="-3"
        android:keyEdgeFlags="right"
        android:keyLabel="OK"
        android:keyWidth="28%p" />
</Row>
<Row>
    <Key
        android:codes="52"
        android:keyEdgeFlags="left"
        android:keyLabel="4" />
    <Key
        android:codes="53"
        android:keyLabel="5" />
    <Key
        android:codes="54"
        android:keyLabel="6" />
    <Key
        android:codes="-5"
        android:isRepeatable="true"
        android:keyEdgeFlags="right"
        android:keyIcon="@drawable/sym_keyboard_delete"
        android:keyWidth="28%p" />
</Row>
<Row>
    <Key
        android:codes="55"
        android:keyEdgeFlags="left"
        android:keyLabel="7" />
    <Key
        android:codes="56"
        android:keyLabel="8" />
    <Key
        android:codes="57"
        android:keyLabel="9" />
    <Key
        android:codes="48"
        android:keyLabel="0"
        android:keyWidth="14%p" />
    <Key
        android:codes="46"
        android:keyEdgeFlags="right"
        android:keyLabel="."
        android:keyWidth="14%p" />
</Row>

4

2 回答 2

27

虽然答案很晚,但它会帮助其他人。

在 KeyboardView 标记中使用android:shadowRadiusandroid:shadowColor属性。

前任:

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboardview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:shadowColor="@android:color/transparent"
    android:focusableInTouchMode="true" 
    android:visibility="gone" />

或者

<android.inputmethodservice.KeyboardView
        android:id="@+id/keyboardview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:shadowRadius="0.0"
        android:focusableInTouchMode="true" 
        android:visibility="gone" />
于 2014-07-01T14:29:38.423 回答
1

您的按键比普通键盘按键大。因此,我猜这些数字键会放大并显示模糊。您将使用自定义可绘制图像。

于 2014-01-27T12:19:34.757 回答