java - sendUserActionEvent() 返回

标签 java android popupwindow dismiss

使用 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 - sendUserActionEvent() 返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52082021/

相关文章:

java - Dagger 2 'can not be provided without'

java - 无法在我的测试类: modifier static not allowed here中创建Lombok类

java - 测试 fragment Activity 时错误膨胀类 fragment

java - Android:返回圆的半径?

android - 无法在 Android Pie 的键盘 View 外显示弹出窗口

Android 弹出窗口不填满屏幕大小?

objective-c - iSpeech API弹出窗口

java - Apache HttpClient 4.3.5 设置代理

java - 使用泰勒级数计算 cos(x)

android - Wowza 直播网址