1

When I tried to create an Android Tv app that contains webview, But the HTML pages are showing zoom in. Also I tried in tab with the same code it's working fine. (HTML pages should open same as it's open in Desktop)

wvContainer.webViewClient = WebViewClient()
        val newUserAgent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0"
        wvContainer.settings.userAgentString=newUserAgent
        wvContainer.settings.javaScriptEnabled = true
        wvContainer.settings.loadWithOverviewMode = true
        wvContainer.settings.useWideViewPort = false
        wvContainer.settings.domStorageEnabled = true
        wvContainer.settings.loadsImagesAutomatically = true
        wvContainer.settings.setSupportZoom(true)
        wvContainer.settings.displayZoomControls = false
        wvContainer.settings.builtInZoomControls = true
        wvContainer.scrollBarStyle = WebView.SCROLLBARS_OUTSIDE_OVERLAY
        wvContainer.isScrollbarFadingEnabled = false
        wvContainer.settings.setAppCacheEnabled(false)
        wvContainer.settings.setCacheMode(WebSettings.LOAD_NO_CACHE)
        wvContainer.settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL)

I am expecting this

But I am getting this

1 Answers1

0

Don't know if you still have this issue, but here's what solved it for me: In your target html file of the web view you're trying to load, add the following:

<meta name="viewport" content="user-scalable=no, initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5, width=device-width, viewport-fit=cover">
Tuxedo Joe
  • 822
  • 6
  • 18