Scroll doesn't work in NestedScrollView when try to scroll from views with click events

overflow-y scroll doesn't work
mouse wheel won't scroll
why is my mouse wheel not scrolling?
overflow scroll not working
div scrollbar
mouse wheel not scrolling properly
scroll-content
no scroll

I'm using a NestedScrollView in a layout, and am attempting to use the new CoordinatorLayout from the design support library for CollapsingToolbarLayout.

My layout file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"

            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">
            <!--            app:expandedTitleMarginEnd="64dp"-->
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:scaleType="centerCrop"
                android:src="@drawable/image_load_default_big" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/anim_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/nestedScrollVw"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|enterAlways"
        android:fitsSystemWindows="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="false"
            android:fitsSystemWindows="true">

            <LinearLayout
                android:id="@+id/changePasswordButtonContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Button
                    android:id="@+id/changePasswordExpand"
                    android:layout_width="match_parent"
                    android:layout_height="55dp"
                    android:background="@drawable/back_img"
                    android:text="Change Your Password"
                    android:textColor="@color/white"
                    android:textStyle="bold" />
            </LinearLayout>


            <LinearLayout
                android:id="@+id/changePasswordContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/changePasswordButtonContainer"
                android:layout_centerInParent="true"
                android:orientation="vertical"
                android:padding="10dp">


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:text="Edit Your Password"
                    android:textColor="@color/orange" />

                <EditText
                    android:id="@+id/etUserName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/edittext_default_bg"
                    android:drawableLeft="@drawable/password_icon"
                    android:drawableRight="@drawable/tick"
                    android:hint=" Old Password"
                    android:padding="12dp"
                    android:password="true"
                    android:textColorHint="#b5b5b5" />

                <EditText
                    android:id="@+id/etPass"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/edittext_default_bg"
                    android:drawableLeft="@drawable/password_icon"
                    android:drawableRight="@drawable/cross"
                    android:hint=" New Password"
                    android:padding="12dp"
                    android:password="true"
                    android:textColorHint="#b5b5b5" />

                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingBottom="20dp"
                    android:paddingTop="20dp"
                    android:text="show password" />

                <Button
                    android:id="@+id/btnSingIn"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"
                    android:background="@drawable/login_button_background"
                    android:paddingBottom="8dp"
                    android:paddingTop="8dp"
                    android:text="Done"
                    android:textColor="@color/white"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/dealerToDealerContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/changePasswordContainer"
                android:orientation="vertical">

                <Button
                    android:id="@+id/dealerToDealerExpand"
                    android:layout_width="match_parent"
                    android:layout_height="55dp"
                    android:background="@drawable/back_img"
                    android:text="Dealer To Dealer Platform No"
                    android:textColor="@color/white"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/dealerToDealerContainer"
                android:layout_centerInParent="true"
                android:orientation="vertical"
                android:padding="10dp">


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:text="Edit Number"
                    android:textColor="@color/orange" />

                <EditText
                    android:id="@+id/dealerToDealerNo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/edittext_default_bg"
                    android:drawableLeft="@drawable/password_icon"
                    android:drawableRight="@drawable/tick"
                    android:hint=" 56546789"
                    android:padding="12dp"
                    android:password="true"
                    android:textColorHint="#b5b5b5" />

                <Button
                    android:id="@+id/dealerToDealerNoDone"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"
                    android:background="@drawable/login_button_background"
                    android:paddingBottom="8dp"
                    android:paddingTop="8dp"
                    android:text="Done"
                    android:textColor="@color/white"
                    android:textStyle="bold" />
            </LinearLayout>

        </RelativeLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

When i try to scroll, sometimes it doesn't work. reason for this is, other elements of layout with click events are consuming the touch event. Basically EditText, RadioButton, Button are consuming touch events. Any Suggestions to solve this problem ?

I had the same problem. It happens only when NestedScrollView content height is less than height of device screen. So the workaround is to use setMinimumHeight(..) method for the view inside your NestedScrollView to make it resize to screen height:

DisplayMetrics displaymetrics = new DisplayMetrics();
getBaseActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int screenHeight = displaymetrics.heightPixels;

int actionBarHeight = 0;
TypedValue tv = new TypedValue();
if (getBaseActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
    actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
}

view.setMinimumHeight(screenHeight - actionBarHeight);

where view is your RelativeLayout

It works fine fore me. Hope it helps you

Css: overflow scroll doesn't work, You have to set a height to the div or else it will expand to the height of its contents .listTweets { overflow : scroll; height: 200px; }. How Do You Scroll Down a Page on a Laptop? You may have to adjust some settings if your touch pad scroll doesn't work. The Old-Fashioned Way. Step 1.

One of your ScrollViews will send all events to the first View that answer true on dispatchMotionEvent.

You may avoid using such scenario in your app OR override all dispatchMotionEvent methods (from scrolls and Views) to not consume the ACTION_DOWN.

Scroll doesn't work, You have used : overflow: hidden; for your html and body . So you wont be able to scroll! When Excel won’t scroll, the solution is hiding under this button on the ribbon. For some reason, Excel randomly freezes the panes on these worksheets from time to time. So, when I click on a tab and the screen won’t scroll, the solution is to click on View, select Freeze Panes, and select Unfreeze Panes.

In your AndroidManifest.xml, make sure you have 'windowSoftInputMode' attribute set to 'adjustResize'.

<activity android:name=".activities.YourActivity"  android:windowSoftInputMode="adjustResize">

Overflow: Scroll doesn't work - HTML-CSS, I have added “Overflow : auto” to the navbar ul and it doesn't work. When I change it to “Overflow: scroll” it never shows a scrollbar. I can't get it  Touchpad scroll not working. ‎09-21-2016 08:41 AM. Hello, about when did this issue start? Have you done any updates recently, or downloading software from a website? What is the model of your laptop? Subscribe to RSS Feed. Email to a Friend. Touchpad scroll not working. ‎09-21-2016 08:47 AM. I understand that you are having issues with

The solution here (a workaround for this google issue by overriding the nestedScrollview) https://gist.github.com/chrisbanes/8391b5adb9ee42180893300850ed02f2 worked like a charm!

Define FixAppBarLayoutBehavior.java

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package your.package;

import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;

/**
 * Workaround AppBarLayout.Behavior for https://issuetracker.google.com/66996774
 *
 * See https://gist.github.com/chrisbanes/8391b5adb9ee42180893300850ed02f2 for
 * example usage.
 *
 * Change the package name as you wish.
 */
public class FixAppBarLayoutBehavior extends AppBarLayout.Behavior {

    public FixAppBarLayoutBehavior() {
        super();
    }

    public FixAppBarLayoutBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target,
            int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
                dxUnconsumed, dyUnconsumed, type);
        stopNestedScrollIfNeeded(dyUnconsumed, child, target, type);
    }

    @Override
    public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child,
            View target, int dx, int dy, int[] consumed, int type) {
        super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
        stopNestedScrollIfNeeded(dy, child, target, type);
    }

    private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
        if (type == ViewCompat.TYPE_NON_TOUCH) {
            final int currOffset = getTopAndBottomOffset();
            if ((dy < 0 && currOffset == 0)
                    || (dy > 0 && currOffset == -child.getTotalScrollRange())) {
                ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
            }
        }
    }
}

Usage in java:

AppBarLayout abl = findViewById(R.id.app_bar);
((CoordinatorLayout.LayoutParams) abl.getLayoutParams()).setBehavior(new FixAppBarLayoutBehavior());

Usage in xml:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_height="..."
            android:layout_width="..."
            app:layout_behavior="your.package.FixAppBarLayoutBehavior">

    </android.support.design.widget.AppBarLayout>

    <!-- Content -->

</android.support.design.widget.CoordinatorLayout>

This is provided in the post Click not working on RecyclerView in CoordinatorLayout when scrolling.

Fix Mouse Zooming Instead of Scrolling (Solved), . If you see no difference with the other keys, you must use the on-screen keyboard (OSK) to make sure that the Ctrl key is pressed or not. The touchpad scrolling could have been disabled through the system reverting to a very basic driver or through user input by adjusting the options within the touchpad's configuration utility, Click Start or tap the Windows key and type mouse the select Mouse from the Control Panel section of the list above.

[Solved] Why no scroll bar when using a div within a div ?, display a vertical scrollbar if I set overflow:auto ? Not for me it doesn't ! Here's my code: <div style='width:100%;height:653px;overflow:auto'>  How to enable touchpad virtual scrolling (Mouse wheel) of Lenovo notebooks

overflow-y: scroll, scrollbar doesn't add the actual bar, The scrollbar container appears, but somehow it doesn't show the actual bar that you do the scrolling with. Neither do the arrow keys let me go  You can tell if Scroll Lock is turned on, because Scroll Lock appears in the Excel status bar. If you suspect that Scroll Lock is turned on, but Scroll Lock does not appear in the Excel status bar, it may be because the status bar is customized to hide the Scroll Lock status.

Scroll with mousewheel doesn't work, [This thread is closed.] On pages where the Wp-contactslider is displayed the mouse scrollwheel seems to be not working anymore. To test the scroll feature in an older laptop, the scroll feature is typically located on the far right of the touchpad (pic). To scroll a browser page (for example): open a web browser, then click in the middle of the browser window to make sure the window is active.

Comments
  • Did you resolved to scroll with clickable views inside? You marked resolved with fill_vertical but to me it only fill the empty space. It still doesn't scroll with clickable views.
  • fill_vertical did not solve the problem, it looks the problem is with CollapsingToolbar, because if we remove CollapsingToolbar it started working fine.
  • With 22.2.1, it seems resolved, can you confirm?
  • @Davidea didn't work for me, is it working for you ?
  • I also have this problem, although, interestingly, I have it in a ViewPager .. but only one Fragment suffers from it, another Fragment correctly deals with scroll events starting from touchables...
  • Setting the view's minimum height to be screenHeight - actionBarHeght, did not solve the problem for me. I tried with setting it a little bigger (for example: screenHeight - actionBarHeight + 5) and it worked. Any ideas why?
  • Is this still necessary? This seems fundamental to Android / Material Design. How could it be overlooked?
  • bingo! Works like a charm. But I wonder, how could it be overlooked being such an important component in Material design as @LukeAllison correctly mentioned!
  • I thought about this and realized that placing a scrollView within a scrollView is not supported as it is not good practice. It renders the parent scrollView useless. Instead, I chose to programmatically resize my view to fit the content as it updated, which in turn increased the height of the parent scrollView. However, this also isn't easy and required hacky code!
  • can you please clarify your answer a bit more for a beginner :)