Note that there are some explanatory texts on larger screens.

plurals
  1. POscaling webview to the entire screen in android
    primarykey
    data
    text
    <p>I am trying to scale the webview to the size of the screen , but I have failed at it .. I have tried lots of combinations but none of them worked for me .What am I missing in that code ? Any help is greatly appreciated. </p> <pre><code>package com.example.images; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class MainActivity extends Activity { private WebView webView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webView = (WebView) findViewById(R.id.webview_compontent); String r="&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0,target-densityDpi=device-dpi\"&gt;"; String s="&lt;html&gt;&lt;head&gt;"+"&lt;style&gt;body{margin:0; }&lt;/style&gt;" +r+"&lt;/head&gt;" +"&lt;body&gt;"+ "&lt;IMG src="+ "\"http://46.20.150.55/member/Resimler/kampanya/195/314/blackmakas1.jpg\"&gt;" + "&lt;DIV style=\"Z-INDEX: 1; POSITION: absolute; TEXT-ALIGN: center; BACKGROUND-COLOR: white;" + "WIDTH: 80px; TOP: 137px; LEFT: 121px\"&gt;564524&lt;/DIV&gt;"+"&lt;/body&gt;&lt;html&gt;"; webView.setBackgroundColor(0); webView.setBackgroundResource(R.drawable.android); webView.loadData(s, "text/html","UTF-8"); //doesn't work /*webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); try { // load the url webView.loadData(s, "text/html","UTF-8"); } catch (Exception e) { e.printStackTrace(); } */ //doesn't work /* webView.setInitialScale(1); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.getSettings().setJavaScriptEnabled(true); */ //doesn't work /* String p="&lt;html&gt;&lt;head&gt;"+"&lt;style&gt;body{margin:0; }&lt;/style&gt;" +r+"&lt;/head&gt;" +"&lt;body&gt;"+ "&lt;IMG src="+ "\"http://46.20.150.55/member/Resimler/kampanya/195/314/blackmakas1.jpg\"&gt;" + "&lt;DIV style=\"Z-INDEX: 1; POSITION: absolute; TEXT-ALIGN: center; BACKGROUND-COLOR: white;" + "WIDTH: 80px; TOP: 137px; LEFT: 121px\"&gt;564524&lt;/DIV&gt;"+"&lt;/body&gt;&lt;html&gt;"; webView.loadData(p, "text/html","UTF-8"); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(false); */ } } </code></pre> <p>Here is main.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;WebView android:id="@+id/webview_compontent" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>And here is manifest file </p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.images" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /&gt; </code></pre> <p></p> <pre><code>&lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/title_activity_main" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>(Editted)</p> <p>The webpage I get is : </p> <p>This is the page that I get .. What I want is to fit that advertisement image to all the screen.</p> <p><img src="https://i.stack.imgur.com/C77JF.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload