|In WebView Scroll to local hyperlink within a html page, does not happen when clicked||Nishma||10/11/12 6:12 AM|
When an WebView is within a scrollview, and if webview contains local hyper-links (anchors with href="#..."), click on these hyper-link, does not scroll to the defined destination. This is the behavior in one of the core apps in Android (ICS)- Email application.
My understanding is: The scrollview being the parent intercepts the touch event and consumes it and also passes it to the children (webview) by returning false. On recieving the event the webview gets the HitTestResult to know if the clicked/touched location is a anchor node. Here for the touch on a hyper-link, the result return type is 7 which means it is an SRC_ANCHOR_TYPE. So the anchor is detected successfully (also the link is highlighted in the UI)
When the webview is a child of LinearLayout, the scroll to the destination of the clicked anchor happens perfectly, but when the webview is a child of ScrollView, the scroll to the destination does not happen. (webview scrollTo, onScrollChanged are not called). Can you please let me know why is this behavior?
Thanks in advance,