prostock
prostock

Reputation: 9545

android popupwindow float outside of parent view

Instead of dismissing a popup, I would like to hide it off screen at position -width,-heigt. When I try to update the popup off screen it gets stopped at the bounds of the parent view. How do I update it off screen, or semi offscreen?

   View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.mylayout,null);
    pop = new PopupWindow(this);
    pop.setTouchable(false);
    pop.setHeight(200);
    pop.setWidth(200);
    pop.setContentView(view);
    pop.showAtLocation(myparentview, 0, 50, 50);    
    pop.update(-200,-200,-1,-1);

Snapshot of problem: won't pass 0,0

Upvotes: 3

Views: 3556

Answers (2)

Raanan
Raanan

Reputation: 4775

I think what you are missing is using the setClippingEnabled with false.

http://developer.android.com/reference/android/widget/PopupWindow.html#setClippingEnabled(boolean)

You should call it before the update() call and this should let you paint the window outside screen bounderies.

Upvotes: 12

Zala Janaksinh
Zala Janaksinh

Reputation: 2927

i don't sure but dear try this.

apply the popwindow width and height according the device as you use. like here you apply 200*200. just apply this height and width runtime.

Upvotes: 0

Related Questions