【问题标题】:sendUserActionEvent() returnedsendUserActionEvent() 返回
【发布时间】:2019-02-04 12:18:35
【问题描述】:

使用 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】:

您可以尝试删除代码并重新编写。可能是剪切、关闭项目、打开项目并将该部分粘贴回去。

【讨论】:

    【解决方案2】:

    这更有可能是设备而不是应用的问题。你的应用程序很好。之前提出过类似问题:sendUserActionEvent() is null

    谢谢。

    【讨论】:

      猜你喜欢
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多