【发布时间】:2017-06-09 20:24:05
【问题描述】:
我试图在一个片段中有两个 RecyclerViews。其中一个是水平对齐的 RecyclerView,另一个是垂直对齐的。但是只有水平的 RecyclerView 是可见的。 (如果我在布局文件中更改 RecyclerViews 的顺序,垂直 RecyclerView 是可见的,所以我很确定 RecyclerViews 没有任何问题。)
根据类似问题的其他答案,我在两个 RecyclerViews 中都添加了 layout_weight=1。但是第二个 RecyclerView 仍然没有显示。
这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/CategoryPageRecyclerView"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:scrollbars="none" />
<android.support.v7.widget.RecyclerView
android:id="@+id/ItemsRecyclerView"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
我感觉 SwipeRefreshLayout 引起了问题。有关如何解决此问题的任何想法?
【问题讨论】:
标签: java android android-fragments android-recyclerview swiperefreshlayout