I have an URL for a blog site and I load it from my Android app like this
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl(myURL);
webView.setWebViewClient(new CustomWebViewClient());
CustomWebViewClient class
private class CustomWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
showProgressDialog(BrowserActivity.this);
}
@Override
public void onPageFinished(WebView view, String url) {
hideProgressDialog(BrowserActivity.this);
}
}
The site loads and it displays some images on 2 rows. If I open the blog from my phone browser and scroll the page to the end, more images are loaded automatically. So the problem is that if the blog is opened from my app it shows only 2 rows and it doesn't load the rest of the images. What can be the problem? How could I fix this?
webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
or use in xml file
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
<WebView
android:id="@+id/mywebview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none" />
</ScrollView>
in Java file
webview.setScrollContainer(false);
启用DOM存储并查看是否有帮助:
webView.getSettings().setDomStorageEnabled(true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.