Webview tips for Android

Source: Internet
Author: User

Webview settings enable two fingers to scale the webpage:

Mwebview. getsettings (). setsuppzoom zoom (true );

Mwebview. getsettings (). setbuiltinzoomcontrols (true );

 

Webview cookies cleanup:

Cookiesyncmanager. createinstance (this );

Cookiesyncmanager. getinstance (). startsync ();

Cookiemanager. getinstance (). removesessioncookie ();

In addition, the method for clearing cache and history records is as follows:

Webview. receivache (true );

Webview. clearhistory ();

 

Android determines whether webview has been rolled to the bottom of the page:
The getscrolly () method returns the distance from the top of the current visible area to the top of the entire page, that is, the scrolling distance of the current content.

The getheight () or getbottom () Methods return the height of the current webview container.

Getcontentheight returns the height of the entire HTML, but it is not the same as the current height of the entire page, because webview has the zoom function,
Therefore, the current height of the entire page is actually the height of the original HTML and then multiplied by the scaling ratio.
Therefore, the correct result should be:

If (webview. getcontentheight * webview. getscale () = (webview. getheight () + webview. getscrolly ())){
// It is already at the bottom
}

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.