在NestedScrollView(Android Studio)中启用intertial scroll

我有一个nestedScrollView(认滚动活动的一部分),它包含一个CoordinatorLayout和RecyclerView来显示带有一些信息的卡片.布局设计为允许卡片在屏幕外显示太多并且让用户向下滚动它们,但是由于某种原因,滚动没有动量到它应该.我环顾四周,前一个问题讲述了如何禁用ScrollView( Android ScrollView disable Inertial scrolling)中的intertial scroll,所以我尝试反过来:
nestedScrollView mgScrollView = (nestedScrollView) findViewById(R.id.my_games_scroll_view);
mgScrollView.setSmoothScrollingEnabled(true);

但这并没有实现.我测试了mgScrollView.setVerticalScrollBarEnabled(true);看看我是否甚至将代码应用于正确的视图,因此滚动条也没有显示出来.所以现在我很困惑我是否将这些方法应用到正确的视图,但由于我没有任何其他ScrollViews,我不知道如果我不正确应该在哪里.我知道我可以在xml中添加滚动条,但我还没有找到惯性滚动的xml代码.有没有办法通过Java或xml添加惯性?

这是content_my_games.xml的代码,它是卡的布局(不要与activity_my_games.xml混淆,后者包含CollapsingToolbarLayout和FAB的代码)

谢谢

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.nestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/my_games_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.abhinav.sportswowandroid.MyGamesActivity"
tools:showIn="@layout/activity_my_games">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    tools:context=".MyGamesActivity">

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

    <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
           app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"
            />

    <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
    </RelativeLayout>
</android.support.v4.widget.nestedScrollView>

解决方法

老问题,但我自己也碰到了这个问题.这解决了我:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setnestedScrollingEnabled(false);

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...