最新のJelly Beanエミュレータの動作に問題があります。私はいくつかEditTexts
私のアプリにあります。 OnEditorActionListener
は、ユーザーがキーボードのEnterキーを押したときに特別な処理を行います。これはICSまで機能しましたが、今やJelly BeanではリスナーコールバックメソッドonEditorAction()
が呼び出されなくなりました。 EditText
には新しい行だけが挿入されます。Jelly BeanエミュレータでEnterキーを押した後にonEditorAction()が呼び出されない
EditText testEditText = new EditText(context);
testEditText.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
Log.d(TAG, "onEditorAction() called");
return false;
}
});
addView(testEditText);
これはジェリービーンのバグです:
これは、この方法を再現することができますか?またはエミュレータで?あるいは、その行動が意図的に変更されていますか?私はこのいくつかをテストしてみた
:null keyevent and actionid = 0 in onEditorAction() (Jelly Bean/Nexus 7)
予想通りこのサンプルプロジェクトが動作します。https://github.com/commonsguy/cw-omnibus/tree/master/ActionBar/ActionBarDemo – CommonsWare
@CommonsWare:ありがとう、私は私のための回避策を見つけましたあなたのコード内の問題。次の操作を行うと、ENTERキーが仮想キーボードのGOキーと交換され、onEditorAction()をトリガーします。editText.setRawInputType(InputType.TYPE_CLASS_TEXT); editText.setImeOptions(EditorInfo.IME_ACTION_GO); – Hendrik
またはXMLの場合:android:imeOptions = "actionGo" \t \t android:inputType = "text" – Hendrik