许多水平RecyclerView在活动中

时间:2016-02-02 07:24:26

标签: android xml

我要求我需要多个水平RecyclerView它的界面类似于Google PlayStore。现在问题是如果我在我的布局中添加ScrollView并运行应用程序,那么它在屏幕上不显示任何内容。 当我删除它时显示RecyclerView

这是XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:orientation="vertical">

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

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

            <android.support.v7.widget.RecyclerView
                android:id="@+id/featured"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10sp"
                android:background="#ECEFF1" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/latest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10sp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/startup"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10sp" />
        </LinearLayout>
    </ScrollView>

</LinearLayout

我该如何解决这个问题。我想将ScrollView添加到活动中,该活动将包含9到10个水平RecyclerView

1 个答案:

答案 0 :(得分:0)

将Recyclerviews的高度设置为实际的dp值