Android 我的ListView不可滚动。我使用了坐标布局

Android 我的ListView不可滚动。我使用了坐标布局,android,listview,android-fragments,android-coordinatorlayout,Android,Listview,Android Fragments,Android Coordinatorlayout,我有一个导航抽屉,里面还有两个碎片。一个片段有一个列表视图,但listview没有被滚动。我得到了数据,但唯一的问题是listview不允许向下滚动 <android.support.design.widget.CoordinatorLayout android:id="@+id/rootLayout" android:layout_width="match_parent" android:la

我有一个导航抽屉,里面还有两个碎片。一个片段有一个列表视图,但listview没有被滚动。我得到了数据,但唯一的问题是listview不允许向下滚动

            <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>
主要活动

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

列表视图

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

好的,在做了一些跟踪和错误之后,我找到了一个修复方法..不确定这样做是否正确..但仍然发布活动\u主布局文件。 只需比较两个活动和主布局文件。我对它做了一些修改

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

好的,在做了一些跟踪和错误之后,我找到了一个修复方法..不确定这样做是否正确..但仍然发布活动\u主布局文件。 只需比较两个活动和主布局文件。我对它做了一些修改

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


请找到图像链接:我只得到前7条记录。。但是这个url大约有118个JSONArray..使用带分页的嵌套滚动,或者只使用嵌套滚动看起来你可以向下滚动,即使你的所有数据都显示出来了我添加了android:nestedScrollingEnabled=“true”在ListView中,但我仍然无法向下滚动..但是嵌套滚动仅适用于棒棒糖或更高版本请查找图像链接:我只获得前7条记录。。但是这个url大约有118个JSONArray..使用带分页的嵌套滚动,或者只使用嵌套滚动看起来你可以向下滚动,即使你的所有数据都显示出来了我添加了android:nestedScrollingEnabled=“true”在ListView中,但我仍然无法向下滚动..但还有一件事嵌套滚动仅适用于棒棒糖或以上列表滚动,但tablayout隐藏了布局的某些部分列表滚动,但tablayout隐藏了布局的某些部分