Popupwindow custom location display implementation code
1、 Overview
In Android, pop-up menu (hereinafter referred to as pop-up window) is a widely used menu presentation method, which provides convenience for user interaction. There are roughly two ways to realize pop-up window: alertdialog and popupwindow. Of course, there are also ways to realize pop-up window by using activity and cooperating with dialog theme on the Internet. Interested friends can also study it. The main difference between alertdialog and popupwindow is the display location:
(1) Alertdialog is fixed in position display. (2) popupwindow is relatively random and can be displayed at any position on the main screen.
2、 Renderings
3、 Code
(1) Code in mainactivity:
(2) The code in the layout file is omitted.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.