5

असल में मुझे 2 समस्याएंकोऑर्डिनेटर के अंदर रीसाइक्लर व्यू के लिए ठीक से काम नहीं कर रहा है

1 है। स्क्रॉल ठीक से काम नहीं कर रहा है, कभी-कभी जब हम किसी विशेष दिशा में बहुत छोटी दूरी को स्क्रॉल करते हैं और स्पर्श छोड़ देते हैं, तो यह उस विशेष दिशा के अंत तक बहुत तेजी से स्क्रॉल करता है यानी

दूसरा। मैं कस्टम टूलबार का शीर्षक ही दिखाया जा सकता है, जब इसके ढह चाहते हैं और जब इसकी विस्तार शीर्षक छिपा जाना चाहिए

यहाँ एक्सएमएल कोड

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

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="256dp" 
    android:id="@+id/appBarLayout" 
    > 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsingToolbarLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     app:contentScrim="?attr/colorPrimary" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:clickable="true" 
     android:foreground="?android:attr/selectableItemBackground" 
     > 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:src="@drawable/imageone" 
      app:layout_collapseMode="parallax" 
      app:layout_collapseParallaxMultiplier="0.7" 
      android:scaleType="fitCenter" 
      /> 

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

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

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

<android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/recyclerview1" 
    android:layout_centerHorizontal="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_marginTop="-30dp" 
    android:layout_marginLeft="3dp" 
    android:layout_marginRight="3dp" 
    /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fabBtn" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:layout_anchor="@id/appBarLayout" 
    app:layout_anchorGravity="bottom|right|end" 
    android:src="@drawable/ic_favourite" 
    android:layout_marginBottom="@dimen/fab_margin_bottom" 
    android:layout_marginRight="@dimen/fab_margin_right" 

    app:fabSize="normal" /> 

enter image description here

+0

गतिविधि (खंड) कोड कहां है? – iamthevoid

+0

क्या आपने इसके लिए समाधान ढूंढ लिया था। मुझे इसी तरह का मुद्दा सामना करना पड़ रहा है। – Gaurav

+0

@ गौरव नोप। जब मैंने इस मुद्दे का सामना किया तो मैंने पुनर्नवीनीकरण के साथ समन्वयक लेआउट का उपयोग करना बंद कर दिया है। आज मैंने फिर से अद्यतन एसडीके के साथ कोशिश की, अभी भी एक ही मुद्दा। इसके बजाय मैं इन दिनों –

उत्तर

0

है // & छुपाएं जब टूलबार का विस्तार हुआ & ध्वस्त

appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 
     boolean isShow = false; 
     int scrollRange = -1; 

     @Override 
     public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { 
      if (scrollRange == -1) { 
       scrollRange = appBarLayout.getTotalScrollRange(); 
      } 
      if (scrollRange + verticalOffset == 0) { 
       //set your title when you scroll up 
       collapsingToolbar.setTitle(title); 
       isShow = true; 
      } else if (isShow) { 
       //title will disappear when you scroll down 
       collapsingToolbar.setTitle(" "); 
       isShow = false; 
      } 
     } 
    }); 
0

कुलदीप द्वारा पहली समस्या का हल दिया जवाब के अलावा नीचे दिया गया है

RecyclerView का बुरा स्क्रॉल व्यवहार को निकालने के लिए बस अपने RecyclerView पर इस विशेषता सेट:

android:nestedScrollingEnabled="false" 

या यह गतिशील रूप से करने के लिए आप इसका उपयोग कर सकते हैं:

recyclerView.setNestedScrollingEnabled(false); 
संबंधित मुद्दे