小编NIP*_*HIN的帖子

设置imeActionLabel时,EditText输入法操作无效

我有一个带有imeoptionsas 的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);.可能是什么问题?

android android-edittext imeoptions

5
推荐指数
1
解决办法
6379
查看次数

工具栏与appcompat v7-21工具栏

两者有什么区别?工具栏中包含的所有功能都不在v7-21工具栏中?使用v7-21收费栏代替工具栏有什么限制?

android android-support-library android-toolbar

3
推荐指数
1
解决办法
1378
查看次数