简体   繁体   English

Android WebView内容缩放

[英]Android WebView content scaling

I have same applications on two devices with different screen sizes, one is 1024x600(180dpi), another is 1280x800(213dpi). 我在具有不同屏幕尺寸的两台设备上有相同的应用程序,一个是1024x600(180dpi),另一个是1280x800(213dpi)。 This app contains webview with dimensions specified in pixels. 此应用包含以像素为单位指定尺寸的网络视图。 On first device it is a little smaller. 在第一个设备上,它要小一些。 The problem is that when I load my custom html page, on first device with smaller screen and webview the page is rendered correct, but on second device with bigger screen and bigger webview, it doesn't fit. 问题是,当我加载自定义html页面时,在屏幕和Webview较小的第一个设备上,页面呈现正确,但是在屏幕更大和Webview较大的第二个设备上,它不合适。 I expected page to fit the second webview following white spaces, because page is fixed size and second device screen is bigger. 我希望页面适合第二个Webview,并紧跟空格,因为页面大小固定且第二个设备的屏幕更大。 How to fix this? 如何解决这个问题?

Html had this line: HTML有这条线:

<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0" />

It was the reason why setInitialScale() didn't work at first. 这就是setInitialScale()最初不起作用的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM