में इंटरटियल स्क्रॉल सक्षम करें मेरे पास एक NestedScrollView (डिफ़ॉल्ट स्क्रॉलिंग गतिविधि का हिस्सा है) जिसमें कुछ जानकारी के साथ कार्ड प्रदर्शित करने के लिए एक समन्वयक Layout और RecyclerView शामिल है। लेआउट को कार्ड को ऑफ-स्क्रीन जाने की इजाजत देने के लिए डिज़ाइन किया गया है, यदि बहुत सारे हैं और उपयोगकर्ता उन्हें नीचे स्क्रॉल करते हैं, हालांकि किसी कारण से स्क्रॉल में इसकी गति नहीं होती है। मैं चारों ओर देखा और एक पिछले प्रश्न एक scrollview (Android ScrollView disable Inertial scrolling) में intertial स्क्रॉल अक्षम करने का तरीका बताया, तो मैं विपरीत करने की कोशिश की:NestedScrollView (एंड्रॉइड स्टूडियो)
NestedScrollView mgScrollView = (NestedScrollView) findViewById(R.id.my_games_scroll_view);
mgScrollView.setSmoothScrollingEnabled(true);
लेकिन यह इसे पूरा नहीं किया। मैंने mgScrollView.setVerticalScrollBarEnabled (सत्य) का परीक्षण किया; यह देखने के लिए कि क्या मैं सही दृश्य में कोड भी लागू कर रहा था, और इसलिए ऐसा होता है कि स्क्रॉलबार भी दिखाई नहीं देते थे। तो अब मैं उलझन में हूं कि क्या मैं उन तरीकों को सही दृश्य में भी लागू कर रहा हूं, लेकिन चूंकि मेरे पास कोई अन्य स्क्रॉलव्यू नहीं है, इसलिए मुझे यकीन नहीं है कि यह गलत है या नहीं। मुझे पता है कि मैं एक्सएमएल में स्क्रॉलबार जोड़ सकता हूं लेकिन मुझे निष्क्रिय स्क्रॉलिंग के लिए एक्सएमएल कोड नहीं मिला है। जावा या एक्सएमएल के माध्यम से जड़ता जोड़ने का कोई तरीका है?
यहाँ content_my_games.xml के लिए कोड है, जो जहां कार्ड के लिए लेआउट जाना है (activity_my_games.xml साथ भ्रमित होने की नहीं है, जो CollapsingToolbarLayout और फैब के लिए कोड घरों) है
धन्यवाद
<?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>