1

我有一個導航抽屜與2多個片段。一個片段有一個列表視圖,但列表視圖不滾動。我正在獲取數據,但唯一的事情是listview不允許向下滾動。我的ListView不可滾動。我已經使用座標佈局

activity_main

  <android.support.design.widget.CoordinatorLayout 
      android:id="@+id/rootLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

      <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> 

      <android.support.design.widget.TabLayout 
      android:id="@+id/tabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabGravity="fill" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

      <android.support.v4.view.ViewPager 
      android:id="@+id/pager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/white" /> 
      </android.support.design.widget.AppBarLayout> 

      </android.support.design.widget.CoordinatorLayout> 
      <android.support.design.widget.NavigationView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:id="@+id/Shitstuff" 
      app:itemTextColor="@color/colorPrimary" 
      app:menu="@menu/drawermenu" 
      android:layout_marginTop="-24dp"> 
      </android.support.design.widget.NavigationView> 
      </android.support.v4.widget.DrawerLayout> 

的ListView

  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       tools:context=".FragmentA"> 

       <ListView 
        android:layout_width="match_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/listView" 
        android:divider="#020202" 
        android:dividerHeight="0.5dp" /> 

      </FrameLayout> 
+0

請找到圖片鏈接:http://postimg.org/image/6gvifajnd/ –

+0

使用嵌套滾動 – Madhur

+0

我只獲得第7條..但URL有大約118 jsonArrays .. –

回答

0

好,做一些記錄和錯誤之後,我發現了一個fix..Not知道這是做什麼或不正確的方式。但仍然發佈activity_main佈局文件。 只需比較兩個activity_main佈局文件。我對它做了一些修改。

   <?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:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:id="@+id/drawerLayout"> 

      <android.support.design.widget.CoordinatorLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
      <FrameLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/containerView"> 

      <android.support.v4.view.ViewPager 
      android:id="@+id/pager" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:background="@android:color/white" 
      android:layout_gravity="center_horizontal|top" /> 

      </FrameLayout> 
      <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

      <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:background="#FFDD00" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> 

      <android.support.design.widget.TabLayout 
      android:id="@+id/tabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:tabGravity="fill" 
      android:background="#FFDD00" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 
      </android.support.design.widget.AppBarLayout> 
      </android.support.design.widget.CoordinatorLayout> 

      <android.support.design.widget.NavigationView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:id="@+id/Shitstuff" 
      app:itemTextColor="@color/colorPrimary" 
      app:menu="@menu/drawermenu" 
      android:layout_marginTop="-24dp"> 

      </android.support.design.widget.NavigationView> 
      </android.support.v4.widget.DrawerLayout> 
+0

列表滾動,但tablayout隱藏佈局的一部分 – Vinay

相關問題