0

NestedScrollViewを使用してスクロールのツールバーを非表示にしていますが、 recyclerViewをスクロールしていません。私はrecyclerView.setNestedScrollingEnabled(false);を使っています。ここでNestedScrollViewの内部でrecyclerViewを使用するときにスクロールのツールバーを非表示にする方法

私のコードです:

<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

こんにちは、あなたのツールバーでxmlコードを共有することができます – Cochi

+0

ちょっと私の編集の質問を参照してください。 –

+0

あなたはapp_bar_navigation_drawerレイアウトも表示できますか? – Cochi

答えて

0
あなたのAppBarLayoutにこのattibuteを追加し、これを試すことができます

app:layout_scrollFlags="scroll|exitUntilCollapsed"

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" 
     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> 

ホープ、このことができます。

私の英語のために残念です。

+0

それは動作しませんでした –

+0

私の編集があなたを助けているかどうかを確認してください。 – Cochi

関連する問題