デバイス用に独自のIMEを作成しています。追加する必要があるのは、下の画像に示すように、keyboardViewの上にあるTextBoxです。下の画像のように表示することはできますが、テキストを書き込むことができません。
キーボードビューを拡張しています。以下はレイアウト構造です
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wrapper"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_width="fill_parent" android:background="@color/background" >
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:id="@+id/txtTest" android:layout_width="fill_parent" android:text="Test" ></TextView>
<EditText android:inputType="text" android:id="@+id/edtTest" android:layout_height="wrap_content" android:layout_width="fill_parent"></EditText>
<com.keyboard.CustomKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:keyTextSize="15sp"
/>
</LinearLayout>
パブリッククラスCustomKeyboardViewはKeyboardViewを拡張します{
static final int KEYCODE_OPTIONS = -100;
private TextView mResultText;
public CustomKeyboardView (Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomKeyboardView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected boolean onLongPress(Key key) {
if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
return true;
} else {
return super.onLongPress(key);
}
}
ありがとう、ニル