sendUserActionEvent()返回的是

问题描述 投票:28回答:1

当使用android studio解除弹出窗口时,我得到了以下错误。代码工作正常,但在logcat上出现以下错误。

E/ViewRootImpl: sendUserActionEvent() returned.

java代码:

LayoutInflater layoutInflater = getLayoutInflater();
View popupView = layoutInflater.from(getActivity()).inflate(R.layout.dayview_popup,null);
popupWindow = new PopupWindow(popupView, Toolbar.LayoutParams.MATCH_PARENT, Toolbar.LayoutParams.WRAP_CONTENT,true);
popupWindow.setOutsideTouchable(true);

....

int[] loc_int = new int[2];
try {
    view.getLocationOnScreen(loc_int);
} catch (NullPointerException npe) {}

Rect location = new Rect();
location.left = loc_int[0];
location.top = loc_int[1];
location.right = location.left + view.getWidth();
location.bottom = location.top + view.getHeight();

popupWindow.setAnimationStyle(R.style.Animation);
popupWindow.showAtLocation(view, Gravity.TOP|Gravity.RIGHT, location.right, location.bottom);

View container = (View) popupWindow.getContentView().getParent();
WindowManager wm = (WindowManager) cntx.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
p.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.7f;
wm.updateViewLayout(container, p);
java android popupwindow dismiss
1个回答
0
投票

这更有可能是设备的问题,而不是应用程序的问题。你的应用程序是好的。以前也有类似的问题。sendUserActionEvent()为空。

谢谢,你可以试着删掉代码再写。


0
投票

你可以尝试删除代码,再重新写一遍。可能是剪切,关闭项目,打开项目,把那部分内容粘贴回去。

© www.soinside.com 2019 - 2024. All rights reserved.