Full resolution WebView on Android TV

Viewed 2901

On a 1080p emulator and Smart TV (nVidia Shield) I only get a 960x540 WebView. Is it possible to use the whole resolution available instead?

enter image description here

4 Answers

Im looking for an answer to the same question, but i can confirm the following.

1080p TV Testing

each device configured in setting to only use 1080p 60Hz

Amazon Firestick gets 960 x 540 px in all browsers tested.

Shield TV gets 960 x 540 px in all browsers tested.

new Amazon Fire TV Cube gets 960 x 540 px in all browsers tested.

4K TV Testing

Amazon Firestick (not 4K compatible) gets 960 x 540 px in all browsers tested.

Shield TV (with output setting at 4K 60Hz) gets 960 x 540 px in all browsers tested.

new Amazon Fire TV Cube (with output setting 4K 60Hz) gets 960 x 540 px in all browsers tested.

whats more bizarre is that both 1080p and 4K test the reported pixelratio was 2. I at least expected to see a pixel ratio of 4 on 960x540 on 4K

I use TVs connected to PC to display large tables of status data. when fully utilized a 70" 4K TV displays hundreds of different bits of info, its a beautiful thing.

then you get an Nvidia Shield because its "4K" and discover the browser renders at 960 x 540, and the page that looks fantastic in 4K looks like blocky illegible crap.

This is what I did in Android TV 28 My app original resolution is 1080p

JS Code:

document.body.style.zoom = 1/window.devicePixelRatio

You can use WebView#setInitialScale to scale the website according to your needs. To get wanted scale you can use the code:

Point metrics = new Point();
((WindowManager) context.getSystemService(WIDNOW_SERVICE)).getDisplay(metrics);
int scale = (int) (((double) metrics.x) / 3840/*SCREEN_WIDTH*/ * 100);

You should not set additional settings like setUseWideViewPort, because it can overwrite/ignore the scale setting.

Related