The android library contains a WebKit library, and a WebKit-based browser is installed by default. At the same time, developers can develop applications based on WebKit (webview ).ProgramSuch applications can directly display web pages, thus improving the development speed. When developing web pages for such applications, some developers need to make some adjustments and changes, the following are summarized in the form of questions and are constantly supplemented.
1. What is a resolution of 480*800 that shows an image with an incomplete width of 480?
Symptom: only a part of the 480 image is displayed, but the 320 image is displayed completely.
Cause Analysis: Android is mapped to the density concept, and the system will have a default value. If your page does not have mandatory requirements, this value will be used. In order to consider compatibility, on machines with a density of 120 and 240, 160 is used by default, resulting in unsatisfactory performance. For details, refer
Solution: declare the DPI adaptation for the device on the page
<Meta Name="Viewport" Content="Target-densitydpi = device-DPI, width = device-width" />
This viewport also has many other attributes, such as controlling the default scaling ratio and whether to allow scaling. For details, refer to the following link.
Http://developer.android.com/guide/webapps/targeting.html
2. android2.3 system. When the input box on the page gets the focus, the whole page is enlarged.
Symptom: The 1-based solution has a problem on the 2.3 System (480*800). You can enter the control to get the focus. The whole page displayed on the keyboard will be enlarged and cannot be displayed all.
Cause Analysis: I checked some information, but this is not the case in the SDK description in 2.3. After testing, I found that the system in 2.3 comes with a browser.User-scalable = NoIt doesn't work at all, and you can still scale it by hand (a program developed based on WebKit does not have this problem, but the page will become larger). Key point: when the input box gets the focus, the page size is exactly the same as DPI = 160 (480*800 DPI is actually 240). In this way, we can find that the priority of the scaling mode in WebKit in 2.3 is higher than that in page settings.
Solution: The system browser has to manually set the zoom mode to far to solve the problem (this seems meaningless)
WebKit-based client programs can directly set the defaultzoom of websetting to farSetdefazoom zoom(Websettings. zoomdensity zoom)
Reference http://developer.android.com/reference/android/webkit/WebSettings.html