When I call showAsDropDown without post, (i.e., straight in code) I see the popup -
PopupWindow w = new PopupWindow(v.getContext());
w.showAsDropDown(v);
however, when I'm trying to use v.post() (either with or without delay), I do not see the popup.
v.post(new Runnable() {
@Override
public void run() {
w.showAsDropDown(v);
}
});
What could be causing this?
Well, I feel rather foolish, but I've found the problem, and am leaving the question + solution for future generations -
The problem was that I forgot to call update in the post :)
v.post(new Runnable() {
@Override
public void run() {
w.showAsDropDown(v);
w.update(v, 0, 0, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
}
});
this code works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With