ghostrider
ghostrider

Reputation: 5259

Webview not showing well

Well this is my xml code

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

and this is my activity code

public class Myact extends Activity {
/** Called when the activity is first created. */
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);



   mWebView = (WebView) findViewById(R.id.webview);
   mWebView.getSettings().setJavaScriptEnabled(true);
   mWebView.loadUrl("my url");


}

}

The problem is that I want the site to adapt to mobile screen and if the user wants to zoom in or out. So far , when the url loads, the user sees only the upper left corner of the site and can scroll to view the rest. What changes do i have to make?

Upvotes: 0

Views: 463

Answers (1)

saravana
saravana

Reputation: 564

Try with websettings for your webview like this....

    browser.getSettings().setLoadWithOverviewMode(true);
    browser.getSettings().setUseWideViewPort(true);

Upvotes: 1

Related Questions