In the H5 fiery era, many frameworks are out of the bottom of the popup window control, in H5 is called pop-up menu Actionsheet, today we also imitate an iOS bottom pop-up window, drawing on the Apple QQ select Avatar function
Don't talk a lot, first of all, to achieve today
Open code for the entire Popupwindow
Step Analysis:
- Layout of the Popupwindow
- Creation of Popupwindow
- Popupwindow Adding animation effects
- Popupwindow Setting the background shadow
- Popupwindow Monitor Click events
- Get the height of the Navigationbar
Popupwindow layout: In layout, design the layouts we need
The effect is:
Popupwindow creation: This creation is the same as our normal control creation method
Popupwindow Add animation effects: We create a Anim folder, create our out and in animation effects, and then add our animations to the style
Popupwindow Setting the background shadow: Set the transparency to 0.5 when the pop-up window is open, and set the transparency to 1 when the popup disappears
Popupwindow Monitor Click event: Listen to our popupwindow inside the control's Click event
Get the height of the Navigationbar: Here you need to fit some phones without navigationbar some phones have, here with the presence of Navigationbar to demonstrate
On the mobile phone where Navigationbar is present, set the location where its popupwindow appears
On a phone without navigationbar, set the location of its Popupwindow
Github:https://github.com/androidhensen/iospopupwindow
Android base Control--popupwindow mimic iOS bottom pop-up window