Can anyone tell me the detail explanation of the param "parent" in the function PopupWindow.showAtLocation(View **parent**,int w,int h);
Thanks in advance!
OnClickListener() { @Override public void onClick(View view) { PopupMenu popupMenu = new PopupMenu(Sample1. this, view); popupMenu. setOnMenuItemClickListener(Sample1. this); popupMenu.
android.widget.PopupWindow. This class represents a popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.
The Android window manager makes sure that the popup window is shown above the activity that showed it. In order for the window manager to do this, it needs to know the window of the activity in question. Since a View is inside a window, it knows what window the activity is in if it knows of a View inside the activity window.
With the parent parameter, you say "I want the popup window above the activity in the window that the View parent is in".
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