私はこれを機能させようとしています: EditText の XML には次のものがあります:
android:imeActionLabel="Search"
android:imeOptions="actionSearch"
しかし、うまくいきません。コード内
search.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
どちらも機能しません。手がかりはありますか?
私はこれを機能させようとしています: EditText の XML には次のものがあります:
android:imeActionLabel="Search"
android:imeOptions="actionSearch"
しかし、うまくいきません。コード内
search.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
どちらも機能しません。手がかりはありますか?
これを試して
あなたのxmlファイルで
<EditText
android:id="@+id/rechercheTextView"
android:layout_width="174dp"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:imeOptions="actionSearch"
android:inputType="text"
/>
あなたのアクティビティで
EditText rechTxt = (EditText) findViewById(R.id.rechercheTextView);
rechTxt.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
Toast.makeText(getApplicationContext(),"search",Toast.LENGTH_LONG).show();
return true;
}
return false;
}
});