Android is similar to the effect of UC browser: slide up the address bar to hide the function

thinking

requirement

Scrollview nested address bar and WebView

Scroll down with your finger (web page up). If the web page has a scroll bar, first scroll the address bar to disappear, and then WebView starts scrolling;

Scroll up with your finger (page down). If the address bar is hidden, the address bar will be displayed slowly first, and then WebView will start scrolling.

Implementation scheme

Paper method

resources

Srollview contains the node address bar and WebView control

Scrollview inherits from Scrollview

Mywebview inherits from WebView

Motionevent.action blocked in ontouchevent_ Move event

onDrawListner

Calculate vertical roll range

main window

Globallayoutlistener gets the address bar and scroll view height

Gesturedetector logical distribution - decide whether to slide the WebView or change the WebView height to change the Scrollview scrolling range (Scrollview always scrolls to the bottom)

WebView detects the current address bar offset after redrawing

summary

The above is the effect of Android similar to UC browser introduced by Xiaobian: slide the address bar up to hide the function, hoping to help 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!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>