66971

Loading Webview is not filled with device screen?

Question:

I have a problem with webview. It is not loaded with full screen. I have tried all post answer from stackoverflow but couldn't solve my problem (webview width and height are match-parent/fill-parent i tried for both)

I am using this in html

<meta content="height = device-height,width = device-width, initial-scale = 1.0, minimum-scale = 1.0,maximum-scale = 2.0, target-densitydpi = dpi_value"/>

And in code am setting the map settings as well

webview.getSettings().setUseWideViewPort(true); webview.getSettings().setLoadWithOverviewMode(true); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true);

I have tried with support for all screens in manifest like

<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />

I am loading the add image from server (image size is 800x720). and only image i am loading not any other data.

Answer1:

Add this command in your webview settings

webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL); webview.getSettings().setLoadWithOverviewMode(true); webview.getSettings().setUseWideViewPort(true); webview.getSettings().setJavaScriptEnabled(true);

Answer2:

Do you support all screen sizes?

Add following to the manifest:

<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/>

Answer3:

What does your layout look like? Make sure your layout_width and layout_height are set to "fill_parent". I think it's set to wrap_content by default.

<WebView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/webView" android:layout_gravity="center"/>

Recommend

  • Viewport on Opera Mini & WM6.1 does not match 100% of the `device-width`
  • how to set EditText TopMargins in dp programatically?
  • Cordova : How to enable viewport zoom
  • 10 inch tablet with 149 PPI is showing as 160 dpi in program
  • Getting proper map boundaries
  • why 0.1+0.2-0.3= 5.5511151231258E-17 in php [duplicate]
  • Embedding a Google map
  • Show records ordered with maximum price first in PHP & MySQL
  • The symbol you provided is not a function
  • How to configure Cygnus in relation to Orion and Cosmos
  • SqlCommand back up Database
  • WPF version of .ScaleControl?
  • blade.php method outputting it's result to the form
  • Salesforce Different WSDL files and when to use
  • C# fibonacci function returning errors
  • xcode don't localize specific strings
  • How to get current document uri in XSLT?
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • What is the purpose of TaskExecutor in spring?
  • D3 get axis values on zoom event
  • Admob requires api-13 or later can I not deploy on old API-8 phones?
  • Bad request using file_get_contents for PUT request in PHP
  • Window Size for Mac application
  • SSO with signing and signature validation doesn't work
  • Fill an image in a square container while keeping aspect ratio
  • Shallow update not allowed (git > 1.9)
  • Deserializing XML into class C#
  • jquery mobile loadPage not working
  • A cron job substitute?
  • How to include full .NET prerequisite for Wix Burn installer
  • Qt: Run a script BEFORE make
  • Bitwise OR returns boolean when one of operands is nil
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?