sendUserActionEvent()返回

46

使用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);

不确定,但可以看看这个链接是否有帮助:https://medium.com/@WeselyOng/a-nasty-webview-error-comes-along-with-senduseractionevent-error-82887cdb1627 或者 https://dev59.com/QlMI5IYBdhLWcg3wVp-m - TechFree
这个回答解决了你的问题吗?sendUserActionEvent()为空 - Astha Garg
请查看此链接:https://dev59.com/QlMI5IYBdhLWcg3wVp-m - Mubashir Murtaza
2个回答

1
你可以尝试删除代码并重新编写。也许是剪切、关闭项目,打开项目,然后将该部分粘贴回去。

0

这更可能是设备的问题,而不是应用程序的问题。您的应用程序没问题。以前也提出过类似的问题: sendUserActionEvent()为空

谢谢。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接