簡體   English   中英

如何在Android的滾動視圖內使用列表視圖?

[英]How can I use listview inside a scrollview in android?

這是我在應用程序中想要的圖像:

這是我在應用程序中想要的圖像

我嘗試在滾動視圖中使用列表視圖,但是問題是我無法將列表視圖拉伸到其完整大小。 誰能告訴我該怎么做?

您可以使用以下示例的recyclerview:

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/nestedScroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_collapseMode="pin">

                <!-- Some views-->


            </LinearLayout>

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_bubhub_comment_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

如果您需要同時滾動兩個布局,則可以在recyclerview中使用以下屬性。 否則,它將作為單個滾動視圖工作。 這些屬性允許RecyclerviewNestedScrollView滾動

app:layoutManager="android.support.v7.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM