简体   繁体   中英

How to display web pages on Android at native resolution

I have an Android TV now.

The system parameters are 1920 x 1080 px 960 x 540 dp

I've finished a web page that I want to display on 1080p TV.

Through Android app's webview.

A 960 x 540 dp Android will let webview display in 960 x 540 px

This data comes from window.screen.height and window.screen.width (javascript)

Is there a solution other than body{zoom:0.5} and divide all px by two?

body{ zoom:0.5 } doesn't work for me, maybe it's because I used echarts

Okay, I found the perfect solution.

I didn't use zoom correctly before.

zoom is very effective

Now 960*540DP android behaves the same under 1080P web

        <style type="text/css">
            body {
                width: 200vw;
                height: 200vh;
                min-height: 200vh;
                zoom: 0.5 !important;
            }

            .mbody {
                height: 100%;
            }
        </style>
    <body>
        <div class="mbody">
        ...
        </div>
    </body>


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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