2017-03-13 1 views
0

Encore une fois, je fais appel à votre sagesse, parce que je ne peux pas résoudre mon problème. J'ai un tiroir avec deux listView. J'ai besoin de défilement général pour toutes les vues, et je peux le faire, mais sans effet d'inertie. Je pleure parce que je suis perdu trois jours sur ce problème. J'essaie de faire ce cas à travers le menu en XML et avec NavigationDrawer, mais cela n'aide pas. J'essaye de mettre ma listview dans un gros aperçu de ROOT LISTVIEW dans Drawer, mais c'est effrayant. Aidez-moi, s'il vous plaît. Je sais, que ScrollView avec listView est une mauvaise solution, mais que puis-je faire? Voici mon code.Comment ajouter mon défilement racine Afficher un effet d'inertie ou de modifier ce code pour mon cas

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 


    <include layout="@layout/toolbar" 

     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:scrollbars="none"> 

    </include> 

    <LinearLayout 
     android:id="@+id/drawer_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:background="@drawable/bg_gradient_vertical" 
     android:orientation="vertical" 
     android:paddingBottom="@dimen/activity_common_margin" 
     android:paddingEnd="0dp" 
     android:paddingLeft="@dimen/activity_common_margin" 
     android:paddingRight="0dp" 
     android:paddingStart="@dimen/activity_common_margin" 
     android:paddingTop="@dimen/activity_common_margin"> 

     <TextView 
      style="@style/drawerHeading" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/label_cabinet_list_view" 
      android:text="@string/drawer_personal_cabinet_header" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:background="@color/colorPrimary" /> 

     <ListView 
      android:id="@+id/cabinet_list_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="none" 
      android:layout_marginBottom="@dimen/activity_min_margin" 
      android:layout_marginLeft="@dimen/activity_common_margin" 
      android:layout_marginStart="@dimen/activity_common_margin" 
      android:layout_marginTop="@dimen/activity_min_margin" 
      android:divider="@color/colorAccentLight" 
      android:dividerHeight="1dp" 
      /> 

     <TextView 
      style="@style/drawerHeading" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/drawer_menu_header" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:background="@color/colorPrimary" /> 

     <ListView 
      android:id="@+id/menu_list_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/activity_min_margin" 
      android:layout_marginLeft="@dimen/activity_common_margin" 
      android:layout_marginStart="@dimen/activity_common_margin" 
      android:layout_marginTop="@dimen/activity_min_margin" 
      android:scrollbars="none" 
      android:divider="@color/colorAccentLight" 
      android:dividerHeight="1dp" /> 



    </LinearLayout> 



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

Répondre

0
  • Je trouve réponse à ma question. Comme mon tiroir ne contient pas beaucoup vue-éléments, je suis refusé de ListView et RecycleView, et juste les a publiées en cours ScrollView.Of, je ne pense pas que c'est une meilleure solution , mais d'autres je ne a trouvé.
<?xml version="1.0" encoding="utf-8"?> 
     <android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" 
      android:layout_width="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      tools:openDrawer="start"> 


      <include layout="@layout/toolbar" 

       android:layout_height="match_parent" 
       android:layout_width="match_parent" 
       android:scrollbars="none"> 

      </include> 

      <ScrollView 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_gravity="start" 
       android:scrollbars="none" 
       android:id="@+id/scroll_drawer"> 

       <include layout="@layout/content_main" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"> 

       </include> 

      </ScrollView> 


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