いくつかの情報を持つカードを表示するためにCoordinatorLayoutとRecyclerViewを含むNestedScrollView(デフォルトのスクロールアクティビティの一部)があります。レイアウトは、カードが多すぎる場合にカードが画面外に出て、ユーザが下にスクロールさせるように設計されていますが、なんらかの理由でスクロールにはそれほど勢いがありません。私は周りを見回したと前の質問には、ScrollView(Android ScrollView disable Inertial scrolling)でintertialスクロールを無効にする方法を告げたので、私は反対のことを実行しようとしました:NestedScrollView(Androidスタジオ)で扇形スクロールを有効にします。
NestedScrollView mgScrollView = (NestedScrollView) findViewById(R.id.my_games_scroll_view);
mgScrollView.setSmoothScrollingEnabled(true);
しかし、これはそれを達成しませんでした。私はmgScrollView.setVerticalScrollBarEnabled(true)をテストしました。私は右のビューにコードを適用していたかどうかを確認するため、スクロールバーも表示されませんでした。だから今私は、私が正しいビューにそれらのメソッドを適用するかどうかについて混乱していますが、私は他のScrollViewsを持っていないので、私が間違っている場合はどこにすべきかわかりません。私はxml自体にスクロールバーを追加することができますが、慣性スクロールのxmlコードは見つかりませんでした。 JavaやXMLで慣性を追加する方法はありますか?
ここでカードのレイアウトは(CollapsingToolbarLayoutとFABのコードを収容するactivity_my_games.xml、と混同しないように)行くところですcontent_my_games.xmlためのコード、
おかげ
<?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>
があります