I have a content issue in webview
Simple web browsing:
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <WebView android:id="@+id/someWebview" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" /> </RelativeLayout>
Here i call it
WebView webView = (WebView)view.findViewById(R.id.someWebview); webView.clearView(); webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.loadDataWithBaseURL(null, content, null, "utf-8", null);
and the content looks something like this.
<!DOCTYPE html> <html> <head> <title>some</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;"/> <style> *{margin:0; padding:0;} html, body{width:100%;} </style> </head> <body> <p style="width:50%; margin: 50px 0 0 100px; background-color: #0000ff">asdasd</p> <div style="width: 20%; margin-left: 50px; background-color:#ff0000; padding:0 50px;"><p style="background-color:#ffffff;">dfgdfg</p><div style="width:30%;margin-left: 50px;background-color:#1e1e1e;">dsdsd</div></div> </body> </html>
So the problem is that margin-left is not working, but margin-top is fine .. how can I fix this? I can't use android: paddingLeft because I only need some content, not all of this
I canβt add an image for publication, so I uploaded them here: http://imgur.com/FObDiaA,q9W5tvV first desktop browser, second web view
Update
So suppose I "solve" the problem in my case with parsing html and adding a container div with paddings in the places where I need it, but it's bad to hack and guess that not everyone can use this, so I think the question is all still open - why the fields on the left / right do not work?
source share