android - How to get softkeyboard height in float window correctly -
here tried measure soft keyboard in full screen mode float window add layoutchangelistener root view this:
monlayoutchangelistner = new view.onlayoutchangelistener() { @override public void onlayoutchange(view v, int left, int top, int right, int bottom, int oldleft, int oldtop, int oldright, int oldbottom) { rect r = getframevisiblepart(); if (ismaybekeyboard(r)) { onkeyboardshow(r.bottom, screenheight - r.bottom); } else if (iskeyboardmaybehide(r)) { onkeyboardhide(); } } }; mrootview.addonlayoutchangelistener(monlayoutchangelistner);
getframevisiblepart:
private rect getframevisiblepart() { rect r = new rect(); mrootview.getwindowvisibledisplayframe(r); return r; }
and here window params:
context context = app.getinstance(); windowmanager.layoutparams params = new windowmanager.layoutparams(); if (build.version.sdk_int >= 19) { point p = new point(); manager.getdefaultdisplay().getrealsize(p); params.width = windowmanager.layoutparams.match_parent; params.height = (p.y > p.x ? p.y : p.x); params.gravity = gravity.top; params.flags = windowmanager.layoutparams.flag_translucent_status | windowmanager.layoutparams.flag_translucent_navigation | windowmanager.layoutparams.flag_layout_no_limits | windowmanager.layoutparams.flag_fullscreen | windowmanager.layoutparams.flag_hardware_accelerated | windowmanager.layoutparams.flag_show_when_locked | windowmanager.layoutparams.flag_dismiss_keyguard ; } else { params.width = windowmanager.layoutparams.match_parent; params.height = windowmanager.layoutparams.match_parent; params.flags = windowmanager.layoutparams.flag_alt_focusable_im | windowmanager.layoutparams.flag_hardware_accelerated | windowmanager.layoutparams.flag_dismiss_keyguard ; } params.type = windowmanager.layoutparams.type_system_error
everythings works well. it's can't click , home button in navigationbar.because of type system_error. tried change type type_system_alert mesure function not work. onlayoutchange function invokes when window first show , change view visibility of childview of window , getframevisiblepart() function return visible area without expected
Comments
Post a Comment