3

Android キーボードの開発: キー プレビューの背景画像を変更するにはどうすればよいですか?

4

1 に答える 1

5

KeyboardView を拡張してカスタム キーボードを作成している場合は、'android:keyPreviewLayout' 属性を使用してカスタム キー プレビュー レイアウトをカスタム KeyboardView に設定できます。

例えば

 <com.example.myApp.MyCustomKeyboardView
        android:id="@+id/keyboard_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:keyPreviewLayout="@layout/my_custom_layout" />

my_custom_layout.xml は、次のようなカスタム プレビュー レイアウトです。

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="80sp"
    android:textSize="40sp"
    android:textColor="?android:attr/textColorPrimaryInverse"
    android:minWidth="32dip"
    android:gravity="center"
    android:background="@color/black"/>

お役に立てれば!

于 2012-09-04T18:38:20.433 に答える