Method of adding floating button on tableview in Android Development
If you paste a button directly on the tableviewcontroller, it will cause the button to scroll. Here are two methods to implement the position fixed floating button on the tableview:
1. Paste tableview on the view, and then paste the hover button on the top of the view
2. Using window
First, take a look at the final effect. Add a floating button on the tableview controller, which cannot scroll with the view
First, introduce the first method above:
1) Create properties for tableview and bottom button
2) Create attribute to top
3) Implement button events
Next, the second method is introduced:
1) Create a window, and the button attribute prevents the window from being released
2) Creating windows and buttons
By default, the system has only one window. In this case, we need to set windowlevel
Window does not need to be added to any view
3) Delay loading the window. Note that we need to create this floating button after the rootwindow is created
4) Implement button events
Note: finally, add a small function to make the button animation appear and disappear when the tableview slides up and down. Here, pull up to disappear and pull down to appear
The above is the method of adding floating buttons on tableview in Android development introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!