hguser
hguser

Reputation: 36028

PopupWindow does not show as expected

I am trying to create and display a 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);
}

But the popupwindow does not show.

Did I miss anything?

Upvotes: 0

Views: 96

Answers (1)

styanton
styanton

Reputation: 676

Try to set size for your TextView.

setWidth(120);
setHeight(120);

If popup window will ignore outside touches, just set background

setBackgroundDrawable(new ColorDrawable(Color.WHITE));

Upvotes: 2

Related Questions