如何在NestedScroll,ConstraintLayout中设置ListView的滚动?

问题描述 投票:1回答:1

我在ListView上添加了我的物品。我可以使用NestedScroll's滚动,但我无法显示我的listView's项目,我只能显示3个。

我想要一个像Twitter个人资料页面的设计

<android.support.design.widget.CoordinatorLayout
    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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".ProfileFragment">

    <android.support.design.widget.AppBarLayout...>

        <android.support.design.widget.CollapsingToolbarLayout
            ...>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbarProfile"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:fillViewport="true">

        <ListView
            android:id="@+id/listViewProfile"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical">
        </ListView>

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

</android.support.design.widget.CoordinatorLayout>
android android-constraintlayout android-nestedscrollview
1个回答
1
投票

启用nestedScrollinglistview

<ListView
     android:id="@+id/listViewProfile"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:nestedScrollingEnabled="true" \\add this line
     android:scrollbars="vertical">
</ListView>
© www.soinside.com 2019 - 2024. All rights reserved.