Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content displayed in a WebView on 4k screen seems to be very low resoultion

I'm displaying websites in a WebView on an Android TV. The device is 4k, but the Android is running in 1080p (and that is OK) BUT the WebView seems to render in a half-HD 540x960 (as reported by JavaScript window.screen.availHeight) - images and fonts look blurry.

This seems to match-up with density settings of a device metrics.density = 2. Is there a way to force full-resolution rendering in the app or the WebView itself?

like image 786
atok Avatar asked Dec 03 '25 10:12

atok


1 Answers

Based from this documentation, The platform now allows apps to request that the display resolution be upgraded to 4K only for the compatible hardware.

To query the current physical resolution, you need to use the Display.Mode APIs. If the UI is drawn at a lower logical resolution and is upscale to a larger physical resolution, be aware that the physical resolution the getPhysicalWidth() method returns may differ from the logical resolution reported by getSize().

So what you need to do is to change the physical resolution by setting the preferredDisplayModeId property of your app’s window.

like image 116
KENdi Avatar answered Dec 05 '25 01:12

KENdi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!