I'm developing an Android app for reading epub books and I use WebView to display the chapter of the book. Inside the book there are internal links with an anchor. (file://some_path/some_file.html#some_hash). When the user clicks on this internal link the WebView goes to the required anchor on all phones except all Samsung devices.
Asked
Active
Viewed 344 times
3
-
Could you provide some specific error, or output? – Justin Fletcher Jun 12 '14 at 15:30
-
The problem is that there are no any specific output. When you click the link it scrolls to wrong place. So actually it works but not as it is supposed to work. – Veronica Jun 12 '14 at 17:07
-
This might be the problem you are having: http://stackoverflow.com/a/8317764/825364 – Steve Tauber Aug 13 '14 at 10:31
-
@SteveTauber unfortunately, my `WebView` is inside of a `RelativeLayout`, not a `ScrollView`. – Egor Neliuba Aug 13 '14 at 14:34
-
Would you mind adding a bit of the code to your question? – Steve Tauber Aug 13 '14 at 14:46
1 Answers
1
Have you tried to provide some custom webviewclient, try this, it may help:
myWebView.setWebViewClient(new MyCustomWebViewClient());
... ...
public class MyCusomWebViewClient extends WebViewClient {
public HelloWebViewClient() {}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
}

Sadegh
- 2,669
- 1
- 23
- 26