0

I am facing a problem to set the side of webpage loaded in android webview.

problem is when i load the login page of the website it gets fitted absolutely well in the webview but wen i click on the hyperlink for new signup then the next page(registration page) loads with 100% scale in the browser and shows horizontal and vertical scroll bars. i want to fit this registration page according to device width.

how to do this please help me

tried almost all option available in stackoverflow n google

Also tell me how to access the SQL database(save and retrieve information from database) on android device which is operating the website

The code i used is :

Java file :

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setLoadWithOverviewMode(true);
    mWebView.getSettings().setUseWideViewPort(true);
     String usrUrl = "http://" + txturl.getText().toString();
    mWebView.setInitialScale(30);
                //mWebView.setMinimumHeight(70);
                //mWebView.setMinimumWidth(30);
    mWebView.getSettings().setSupportMultipleWindows(true);
    mWebView.getSettings().setUseWideViewPort(true);
                //mWebView.setWebViewClient(mWebView.set)
                //mWebView.setWebViewClient(clbk.shouldOverrideUrlLoading(mWebView, usrUrl));
                //mWebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    mWebView.loadUrl(usrUrl);

In Manifest file :

    <meta name="viewport" content="target-densitydpi=device-dpi, width=240px" />
1
  • now i am able to fit the registration page in th phone screen but now i am having problem in zoom in and zoom out of the page.Then i have to access the SQL database from the application . Please help me how to do it Commented Jun 24, 2011 at 9:33

1 Answer 1

1

You could do something like this

  webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);

EDIT

You'll then need:

  webview.getSettings().setBuiltInZoomControls(true);

to alter the zoom afterwards

Sign up to request clarification or add additional context in comments.

5 Comments

@Blundell : wat will this do in my application ?
It sets the default zoom when you appear on the page, so it'll zoom out.
page is zooming in well bt does not zoom out how to fit page again on devices screen after filling all the fields in the registration form ?
please tell me about using SQL db with android too
by using webview.getSettings().setBuiltInZoomControls(true); webpage zooms in and zooms out on double tap

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.