Forum Xamarin.Android

How to disable scrolling in Xamarin Android for NestedScrollView targeting KitKat?

I'm working with Xamarin Studio, I'm using the Support Library to use the newer components in KitKat devices.

I have a NestedScrollView which I wish to disable it's scrolling.

I have tried with:

currentScrollView.NestedScrollingEnabled = false;

But it throws a NoSuchMethodError, also I tried:

ViewCompat.SetNestedScrollingEnabled(false);

But using ViewCompat I don't see the scrolling being disabled.

Is there a way to disable the scrolling in a NestedScrollView targeting ?

Answers

  • auamendozaauamendoza MXMember

    I don't have a CollapsingToolbarLayout, the scrolling is performed by the NestedScrollView, I'm animating the NestedScrollView on it's Y axis, when the NestedScrollView detects a move touch event from down to up it shows the NestedScrollView in full, when the move touch event goes from up to down it hides most of it, leaving only the first child view visible.

    I want to disable the scrolling in it to avoid it from scrolling while the user is performing the move touch event.

  • LearnEverythingLearnEverything USMember ✭✭✭
    edited August 2019

    NestedScrollView for multiple recycleviews //set recycleviews to android:nestedScrollingEnabled="false"

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v4.widget.NestedScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
         android:background="@android:color/transparent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:background="@android:color/transparent"
            android:scrollbars="vertical"
            android:nestedScrollingEnabled="false"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerViewEty"
            android:background="@android:color/transparent"
            android:scrollbars="vertical"
            android:layout_width="fill_parent"
            android:nestedScrollingEnabled="false"
            android:layout_height="fill_parent" />
    </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
    
    
    

    Result

Sign In or Register to comment.