Androidカスタムキーボードを開発中です。私はandroid.view.inputmethod.InputMethodSubtype
を私のコードにインポートしましたが、これを実行している間に、私はこのインポートされたもののようなエラーメッセージが表示されて解決できません。 1.6以上のAndroidバージョンがIMFをサポートすると私が知る限り、インストールする必要のあるEclipseプラグインはありますか?Androidカスタムキーボード実装
1
A
答えて
0
質問は非常に古くなっていますが、これを見る別のユーザーを助けるかもしれないので、私はそれに答えています。
問題を解決するためにEclipse用のプラグインがあるかどうか尋ねられましたが、今はAndroidスタジオがあります。
実装したい方Android Custom Keyboard: 最初にAndroidカスタムキーボード用のGoogleサンプルプロジェクトをダウンロードしてください。
1つのテーマ(カスタムレイアウト)、2)サブタイプ、3)絵文字の3つの重要な機能が必要です。
テーマ/レイアウト用:レイアウトファイルを作成します。サブタイプについて
@Override
public View onCreateInputView() {
// Set custom theme to input view.
int themeLayout = sharedPreferences.getInt(THEME_KEY, R.layout.input_1);
mInputView = (LatinKeyboardView) getLayoutInflater().inflate(
themeLayout, null);
mInputView.setOnKeyboardActionListener(this);
// Close popup keyboard when screen is touched, if it's showing
mInputView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
mInputView.closing();
}
return false;
}
});
// Apply the selected keyboard to the input view.
setLatinKeyboard(getSelectedSubtype());
return mInputView;
}
:
<com.domain.keyboard.android.LatinKeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/kb_bg_9"
android:keyBackground="@drawable/key_bg_fill_white"
android:keyPreviewLayout="@layout/key_preview_layout"
android:keyPreviewOffset="@dimen/keyPreviewOffset"
android:keyTextColor="@color/white"
android:popupLayout="@layout/keyboard_popup_layout" />
そしてSoftKeyboard.java
に次のコードを使用します。以下の例のコードを参照してくださいqwerty.xml
のコピーを作成し、キーを交換し、それを編集します。 LatinKeyboard
の別のインスタンスをSoftKeyboard.java
に作成し、if
またはswitch
ロジックを使用します。
private LatinKeyboard getSelectedSubtype() {
final InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype();
String s = subtype.getLocale();
switch (s) {
case "ps_AF":
mActiveKeyboard = mPashtoKeyboard;
mCurKeyboard = mPashtoKeyboard;
break;
case "fa_AF":
mCurKeyboard = mFarsiKeyboard;
break;
default:
mCurKeyboard = mQwertyKeyboard;
}
return mCurKeyboard;
}
そして追加するmethods.xml
を編集サブタイプ:顔文字については
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.sunzala.afghankeyboard.android.ImePreferences"
android:supportsSwitchingToNextInputMethod="true">
<subtype
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard"
android:label="@string/label_subtype_generic" />
<subtype
android:imeSubtypeLocale="ps_AF"
android:imeSubtypeMode="keyboard"
android:label="@string/label_subtype_generic" />
<subtype
android:imeSubtypeLocale="fa_AF"
android:imeSubtypeMode="keyboard"
android:label="@string/label_subtype_generic" />
</input-method>
:ライブラリを検索し、キーボードでそれを統合します。顔文字はキーを押すと表示されます。
if (primaryCode == -10000) {
showEmoticons();
}
ここで、-10000
はkeycodeです。
関連する問題
- 1. Androidカスタムキーボード
- 2. iOSのカスタムキーボード実装のチュートリアルはありますか?
- 3. Android実装ナビゲーション
- 4. カスタムキーボード
- 5. Androidページカールの実装
- 6. Androidライブラリプロジェクトの実装
- 7. Androidフラグメントの実装
- 8. Androidゲームハイスコアの実装
- 9. Androidベストロケーションリスナーの実装
- 10. Androidでのバーコードの実装
- 11. android getText(int resId)実装
- 12. Multidepth ExpandableListの実装Android
- 13. Android用Admobの実装
- 14. Android PreferenceScreen「カラーピッカー」の実装
- 15. whileループの実装はandroid
- 16. Androidでのリモートアクセスの実装
- 17. Android開発のJPA実装
- 18. キャンバスを実装するandroid
- 19. Androidの複数の実装
- 20. Android Widevine DASHの実装+ ExoPlayer
- 21. Androidライブラリ実装の問題
- 22. Android:テンキーパッドの実装方法
- 23. AndroidでのBonjourの実装
- 24. カスタムキーボード予測テキスト
- 25. xcode 4.3 - UITextField - カスタムキーボード
- 26. カスタムキーボードのタッチイベント
- 27. xcode 4 - カスタムキーボード
- 28. カスタムキーボードまたはバーチャルキーボード
- 29. Androidでプログラマチックにカスタムキーボード浮動を作る方法
- 30. EditText用のカスタムキーボードを自動的に表示します。 Android