开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜