簡體   English   中英

WebView加載錯誤的分辨率

[英]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(“大”)。

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

關於顯示和布局(Amazon Fire TV)

當您的應用運行時,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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM