简体   繁体   English

WebView加载错误的分辨率

[英]WebView is loading wrong resolution

I'm working on an App for Fire TV. 我正在为Fire TV开发App。 I'm using a TV with 1920px width. 我正在使用1920像素宽的电视。 In the App is a Webview in full size (match_parent). 在应用程序中是完整大小的Webview(match_parent)。 But if I check the Resolution of the WebView (window.screen.availWidth) it's only 960px. 但是,如果我检查WebView的分辨率(window.screen.availWidth),则只有960px。

Could anybody help me please? 有人可以帮我吗?

The Amazon Fire TV platform scales your resources to the appropriate TV output. Amazon Fire TV平台会将您的资源扩展到适当的电视输出。 For 1080p the screen size is 1920x1080px, the density is 320dpi (“xhdpi”) and the output resolution is 960x540dp (“large”). 对于1080p,屏幕尺寸为1920x1080px,密度为320dpi(“ xhdpi”),输出分辨率为960x540dp(“大”)。

https://developer.amazon.com/docs/fire-tv/design-and-user-experience-guidelines.html#screen-size-and-resolution https://developer.amazon.com/docs/fire-tv/design-and-user-experience-guidelines.html#screen-size-and-resolution

With reference to Display and Layout (Amazon Fire TV) 关于显示和布局(Amazon Fire TV)

When your app runs, Fire TV loads your resources from the appropriate folder. 当您的应用运行时,Fire TV将从相应的文件夹加载资源。 See below image Display and Layout for more information on the resource configurations available for Amazon Fire TV. 请参阅下图显示和布局,以获取有关可用于Amazon Fire TV的资源配置的更多信息。
android screen resolution android屏幕分辨率

在此处输入图片说明

You can use html 'initial-scale' for to fit the template 您可以使用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.

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