Panos Panos - 1 year ago 269
Android Question

Android WebView inside ScrollView scrolls only scrollview

In my app I have a ScrollView that contains some linearviews, some textviews and One Webview, then other linear layouts etc. The problem is that the WebView does not scroll. The Scroll listens only on ScrollView.
Any suggestions??

<ScrollView >
<TextView />
<WebView /> <-- this does not scroll
<TextView />
</ScrollView >

Answer Source

Here is the solution. Found online. I have subclassed WebView and i'm using the requestDisallowInterceptTouchEvent(true); method to allow my webview to handle the scroll event.


public class TouchyWebView extends WebView {

    public TouchyWebView(Context context) {

    public TouchyWebView(Context context, AttributeSet attrs) {
        super(context, attrs);

    public TouchyWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

    public boolean onTouchEvent(MotionEvent event){
        return super.onTouchEvent(event);

And in layout.xml

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download