android - Delete margins in webView -


I can see as you picture problems with webview white margins I want to fill my picture to the photo how can I do this? This photo is: Enter image details here

This code is: webview web = new webview (getContext ()); Web.getSettings () setJavaScriptEnabled (true). . Web.getSettings () setBuiltInZoomControls (true); String imagePath = id; String html = "& LT; html & gt; & lt; body & gt; & lt; img src = \" "+ ImagePath +" \ "& gt; & lt; / body & gt; & lt; / html & Gt; "; Web.loadDataWithBaseURL ("File: /// mnt / sdcard / DinEgen /", html, "text / html", "utf-8", blank); Web.setPadding (0, 0, 0, 0); Web.setInitialScale (1); Web.getSettings () setJavaScriptEnabled (true). . Web.getSettings () setLoadWithOverviewMode (true); . Web.getSettings () setUseWideViewPort (true); Web.setScrollBarStyle (WebView.CROLLBARS_OUTSIDE_OVERLAY); Web.setScrollbarFadingEnabled (false);

XML file:

  & lt; LinearLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" Android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" android: orientation = "vertical" android: weightSum = "100" & Gt; & Lt; android.support.v4.view.ViewPager android: id = "@ + id / presentation_viewPager" Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "95" / & gt; & Lt; LinearLayout android: id = "@ + id / presentation_indicatorLayout" Android: Layout_width = "Match_parent" Android: layout_height = "0dp" Android: layout_weight = "5" android: gravity = "center" android: background = "@ drawable / Select_small_normal" & Gt; & Lt; / LinearLayout & gt; & Lt; / LinearLayout & gt;    

Replace it with the tags:

  & Lt; Body style = 'margin: 0; Padding: 0; ' & Gt;   

Here's another tip for images in the webview: Add a style that fits the images in the width of the screen. Works fine on all screen sizes:

  & style; Style = 'text / css' & gt; IMG {max-width: 100%} height: initial;} div, p, span, one {max-width: 100%;} & lt; / Style & gt;    

Comments