0

Ich benutze NestedScrollView, die zum Ausblenden der Symbolleiste auf Bildlauf, aber wenn ich setzen recyclerView drin, Symbolleiste nicht auf Scroll versteckt und ich evry mögliche Antwort in Stackoverflow aber nothings worsks und speziell ich benutzte recyclerView.setNestedScrollingEnabled(false);.wie man Symbolleiste auf Scroll verstecken, wenn RecyclerView in NestedScrollView verwendet

Hier ist mein Code:

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 



    android:layout_width="match_parent" 
    android:layout_height="match_parent" 

    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

<RelativeLayout 

    android:layout_width="match_parent" 
    android:background="#fff" 
    android:layout_height="wrap_content" 
    > 



    <android.support.v7.widget.RecyclerView 



     android:id="@+id/recyclerView" 
     android:background="#fafafa" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_centerInParent="true" /> 

    <ProgressBar 
     android:id="@+id/progressBar1" 

     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" /> 

</RelativeLayout> 

</android.support.v4.widget.NestedScrollView> 

--- EDIT -----------

<?xml version="1.0" encoding="utf-8"?> 


<android.support.v4.widget.DrawerLayout 

    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/DrawerLayout" 

    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:elevation="7dp"> 
    <include 
     android:id="@+id/includeAppBar" 
     layout="@layout/app_bar_navigation_drawer" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 


    <android.support.v7.widget.RecyclerView 
     android:id="@+id/RecyclerView" 
     android:layout_width="320dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="left" 

     android:background="#ffffff" 
     android:scrollbars="vertical"> 

    </android.support.v7.widget.RecyclerView> 
</android.support.v4.widget.DrawerLayout> 

---- EDIT 2 ----

<?xml version="1.0" encoding="utf-8"?> 
<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.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 

     android:theme="@style/ThemeOverlay.AppCompat.Dark"> 
     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      app:theme="@style/ToolBarStyle" 
      app:layout_scrollFlags="scroll|enterAlways" 
      android:layout_height="?attr/actionBarSize" 
      /> 


     <!-- our tablayout to display tabs --> 
     <android.support.design.widget.TabLayout 
      android:id="@+id/tabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="#fff" 
      app:tabTextColor="#a6a2a2" 
      app:tabSelectedTextColor="#0099ff" 
      app:tabIndicatorColor="#0099ff" 


      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 
    </android.support.design.widget.AppBarLayout> 
    <!-- View pager to swipe views --> 
    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_width="match_parent" 
     android:layout_height="fill_parent"/> 






</android.support.design.widget.CoordinatorLayout> 
+0

Hallo, können Sie den XML-Code mit Ihrer Symbolleiste teilen – Cochi

+0

hey meine Bearbeitungsfrage sehen. –

+0

Kannst du bitte auch das Layout von app_bar_navigation_drawer zeigen? – Cochi

Antwort

0

du versuchen können, diese attibute zu Ihrem AppBarLayout hinzufügen:

app:layout_scrollFlags="scroll|exitUntilCollapsed"

EDIT:

Ihren Code ändern, wie unten auch:

<?xml version="1.0" encoding="utf-8"?> 


<android.support.v4.widget.DrawerLayout 

    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/DrawerLayout" 

    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:elevation="7dp"> 
    <include 
     android:id="@+id/includeAppBar" 
     layout="@layout/app_bar_navigation_drawer" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 


    <android.support.v7.widget.RecyclerView 
     android:id="@+id/RecyclerView" 
     android:layout_width="320dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="left" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" // new attibute 
     android:background="#ffffff" 
     android:scrollbars="vertical"> 

    </android.support.v7.widget.RecyclerView> 
</android.support.v4.widget.DrawerLayout> 

this helps .

Entschuldigung für mein Englisch.

+0

Nopes hat es nicht funktioniert –

+0

Sehen Sie, ob meine Bearbeitung Ihnen hilft. – Cochi

Verwandte Themen