【发布时间】:2016-07-22 05:42:17
【问题描述】:
我正在尝试将两个回收器视图添加到单个布局中,该布局位于 Fragment 中。但我只能看到第一个RecyclerView。
是否可以像上图一样添加两个回收器视图(两者都需要同时可见),或者android中是否存在某种限制,只能将一个回收器视图添加到一个完整的屏幕??
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/test_recycle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#FFCC00"
android:dividerHeight="4px"
android:background="#e0e0e0"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/test_recycle2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#FFCC00"
android:dividerHeight="4px"
android:background="#e0e0e0"/>
</LinearLayout>
</LinearLayout>
【问题讨论】:
-
显示您的 xml。这可以通过 LinearLayout 和权重来完成。
标签: android xml android-studio android-fragments android-recyclerview