Popupwindow for Android UI design and development imitates the pop-up menu at the bottom of Tencent News
In the previous article, popupwindow was used to realize the function of pop-up window. Let's briefly introduce the following.
The official document explains this: This is a pop-up window that can be used to display any view. The pop-up window that appears is the current activity of a floating container.
1. First, let's have a simple chestnut. The effect is as follows:
There are only two layout files, one is pop-up layout (only one picture) and the other is main interface layout (only one button).
Then, instance popupwindow in the main interface code, specify the pop-up interface, and show or hide the pop-up window in the button click event. The code is as follows:
2. After knowing how to realize popupwindow pop-up, use its features to replace the menu bar of the system and create a menu imitating Tencent News. The effect diagram is as follows:
Take some time to adjust the layout, and it will come out naturally. It is mainly the logic code of the main interface. The menu is displayed through popupwindow. The specific code is as follows:
Source code address: https://github.com/YeXiaoChao/Yc_ ui_ popup_ window
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.