Popup window android 不是在 android 中设置上面的视图吗?

Popup window android is not setting above view in android?

在页面的右下角,我有一个关于我打开弹出窗口的点击视图 window。但它打开了重叠的视图。我希望它在视图上方打开。

以下为截图。

下面是我的代码 将 window 创建为

seasonEpisodePopUpWindow = new PopupWindow(this);
        seasonEpisodePopUpWindow.setContentView(seasonEpisodeView);
        seasonEpisodePopUpWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        seasonEpisodeView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
        seasonEpisodePopUpWindow.setWidth(seasonEpisodeView.getMeasuredWidth() * 2);

这就是我打开弹出窗口的方式 window

int[] viewLocation = new int[2];
    anchorView.getLocationOnScreen(viewLocation);
    if (!seasonEpisodePopUpWindow.isShowing()) {
        seasonEpisodePopUpWindow.showAtLocation(anchorView, Gravity.TOP, viewLocation[0], viewLocation[1] - anchorView.getHeight());
    }

如何打开我的视图上方的视图?

能够通过以下方法解决这个问题

seasonEpisodePopUpWindow.showAtLocation(anchorView, Gravity.BOTTOM, viewLocation[0], anchorView.getHeight());