2

I'm in need of two things:

I need to display a webview that shows the entire webpage (horizontally), and automatically shrinks it to whatever width necessary to display the entire page edge to edge. I'm curious if this a) can be done at all b) if so, is this something I can control with JUST the WebView or c) if I need to modify the HTML of the page to squeeze into whatever the container happens to be.

I have a situation where I need to display Facebook (and Twitter and Pinterest) in WebViews that scale to the size of the device and I want to make sure the WebViews show the entire page rather than creating Horizontal scrollbars.

Then, I'm curious if there's some way I can auto scroll down to a specific coordinate from the WebView so that I can scroll down beneath the massive banners that Twitter and Facebook have at the top and display the users' content without them having to scroll down manually.

Can this be done?

Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236

1 Answers1

5

In order to have the WebView shrink the page to the width of the screen, use the following settings in your code.

WebView webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);

you can use:

int x = 0, y = THE_NUMBER_YOU_WANT;
view.scrollTo(x,y);

to scroll to any position on the webpage, determining how far you have to scroll down will be challenging though.

Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236
anthonycr
  • 4,146
  • 1
  • 28
  • 35