我有一个带有imeoptions
as 的Edittext actiongo
.当按下软键盘输入按钮时,我触发了我的事件.
mModelId.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
// if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
if (actionId == EditorInfo.IME_ACTION_GO) {
id = mModelId.getText().toString();
System.out.println("Model id in Edittext:-"+ id);
Toast.makeText(getActivity(), "You entered "+id, Toast.LENGTH_LONG).show();
System.out.println("Before Call Volley");
callVolley();
handled = true;
}
return handled;
}
});
Run Code Online (Sandbox Code Playgroud)
一切正常,但是当我添加actionlabel来输入密钥时,事件没有触发. mModelId.setImeActionLabel("Search Model", KeyEvent.KEYCODE_ENTER);
.可能是什么问题?
两者有什么区别?工具栏中包含的所有功能都不在v7-21工具栏中?使用v7-21收费栏代替工具栏有什么限制?