imeOptions =「actionSearch」:私はAndroid上で自分自身のイベントを書き込むことができますか?
-
25-09-2019 - |
質問
私はアンドロイド使用しています:imeOptions = "actionSearch"
EDITTEXTと私の質問ユーザーがSoftkeyboard?で検索]を押した場合、私は自分自身のイベントを書き込むことができているでは
actualy私たちはアンドロイド活動に使うボタンに似softkeyboard検索ボタンの機能を実行したい。
すべてのヘルプはにappriciatedされるだろう。
解決
これは私が使用して終了するものである。
EditText SearchEditText = (EditText) findViewById(R.id.txtMapSearch);
SearchEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
if (arg1 == EditorInfo.IME_ACTION_SEARCH) {
// search pressed and perform your functionality.
}
return false;
}
});
他のヒント
ユーザーがソフトキーボード上のアクションボタンをタップしたときに呼び出されますsetOnEditorActionListener()
を登録するEditText
上のコールTextView.OnEditorActionListener
ます。
所属していません StackOverflow