HUSTEN
HUSTEN

Reputation: 5197

How can I adjust width of webview?

My code is affective when the user is accessing the pages by clicking a link.
But when the user press Back Button content won't fit :(

This is my current code for pressing Back Button

if(keyCode == KeyEvent.KEYCODE_BACK){
    WebView  myWebView = (WebView)findViewById(R.id.webView1);
    myWebView.getSettings().setSupportZoom(true); 
    myWebView.getSettings().setLoadWithOverviewMode(true);
    myWebView.getSettings().setUseWideViewPort(true);
    myWebView.goBack();
}

How can I solve?

Upvotes: 0

Views: 101

Answers (1)

androidu
androidu

Reputation: 4728

If your website text is being wrapped, use:

webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL) or

webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN)

Upvotes: 1

Related Questions