[英]WebView is loading wrong resolution
我正在为Fire TV开发App。 我正在使用1920像素宽的电视。 在应用程序中是完整大小的Webview(match_parent)。 但是,如果我检查WebView的分辨率(window.screen.availWidth),则只有960px。
有人可以帮我吗?
Amazon Fire TV平台会将您的资源扩展到适当的电视输出。 对于1080p,屏幕尺寸为1920x1080px,密度为320dpi(“ xhdpi”),输出分辨率为960x540dp(“大”)。
当您的应用运行时,Fire TV将从相应的文件夹加载资源。 请参阅下图显示和布局,以获取有关可用于Amazon Fire TV的资源配置的更多信息。
android屏幕分辨率
您可以使用html'initial-scale'来适合模板
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0">
<script>
/**
* This script will set the 'initial-scale' value on the viewport metatag
* The scale is used to fit the template on Kindle Fire mobile devices
* This must be handled in the head of the document because the scale
* is not affected once the page finishes loading
*/
var vp = document.getElementById('viewport');
var initialScale = Math.max(screen.width, screen.height) / 1920;
vp.setAttribute('content', 'width=device-width, initial-scale=' + initialScale + ', maximum-scale=' + initialScale, +'minimum-scale=' + initialScale);
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.