开发者

Android:Is it possible to communicate with input method without a normal textview like edittext?

开发者 https://www.devze.com 2023-01-04 22:00 出处:网络
If I popup input method with togglesoftinput,my view\'s onCreateInputConnection was not called, and i can not com开发者_JAVA百科municate with input method.

If I popup input method with togglesoftinput,my view's onCreateInputConnection was not called, and i can not com开发者_JAVA百科municate with input method.

And then i try to attach the input method to my view:

public boolean showSoftInput(View view, int flags,ResultReceiver resultReceiver) {
   checkFocus();
   synchronized (mH) {
      if (mServedView != view && (mServedView == null || !mServedView.checkInputConnectionProxy(view))) {
         return false;
      }
   }
...

but it returns false

How can I force onCreateInputConnection to be called?

or

How can I make mServedView == view ?


hurray,I do it.

yeah,,,like this:

main_view.setFocusable(true);
main_view.requestFocus();
main_view.setFocusableInTouchMode(true);
main_view.requestFocusFromTouch();
0

精彩评论

暂无评论...
验证码 换一张
取 消