Android webview scaling and line feed

Source: Internet
Author: User
1. webview supports page scaling. Generally, the following settings can meet the 80% requirement.

// Zoom Switch

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

Setting this attribute only supports double-click scaling and does not support touch Scaling (this is true in android4.0 and has not been tried on other platforms)

// Set whether to zoom
Webview. getsettings (). setbuiltinzoomcontrols (true );

If this attribute is set, webview. getsettings (). setsuppzoom zoom (true) is also set to true by default.

2. Unlimited Scaling

Unlimited scaling, you need to use the large view mode, as shown below:

// Unlimited Scaling
Webview. getsettings (). setusewideviewport (true); this attribute can be scaled in any proportion.

Note: 1. The initial scaling value can be set as follows: webview. setinitialscale (initalvalue );

2. After zooming, to adapt the content to the screen, do not go beyond the screen display, implement line feed. In this regard, the effect should be controlled by HTML rather than webview. For example, <P style = "word-break: Break-all"> test </P> Enables automatic line feed.

 

Address: http://blog.sina.com.cn/s/blog_4b00db8201013ypl.html

Enable/disable zoom in Android webview-Stack Overflow
Http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview

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.