0

我正在尝试创建和显示PopupWindow

private void setupPopupWindow() {
    TextView popTextView = new TextView(this);
    popTextView .setText("xxxxxxxxxxxxx");

    mPopupWindow = new PopupWindow(popTextView );
    mPopupWindow.setTouchable(true);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.showAtLocation(anotherViewInMyActivity, Gravity.CENTER, 120, 120);
}

popupwindow不显示。

我错过了什么吗?

4

1 回答 1

2

尝试为您的TextView.

setWidth(120);
setHeight(120);

如果弹出窗口会忽略外部触摸,只需设置背景

setBackgroundDrawable(new ColorDrawable(Color.WHITE));
于 2013-11-12T10:05:51.807 回答