I am making an ebook reader which uses epub format to load books into webviews. In some of the books there is an anchor link to some portions in the same chapter. Each chapt
I am not sure whether the below will resolve your problem or not.
Please add below code before setting the WebViewClient
reader.getSettings().setLoadWithOverviewMode(true);
reader.getSettings().setUseWideViewPort(true);
/*This makes the layout/page rendering independent of the devices.
I use this to display local HTML pages.*/
reader.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
In addition I have zoom controls enabled. Please note that I have tested my code from API-10 onwards with multiple devices and brands (HTC, Samsung, Nexus etc.) and found that the shouldOverrideUrlLoading
works all the time.
If things do not work well, try extending the WebViewClient and Override the shouldOverrideUrlLoading
method
class MyWebView extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false; //THis should be false always
}
}
Now set the WebViewClient as reader.setWebViewClient(new MyWebView());