【发布时间】:2017-08-15 05:50:50
【问题描述】:
如何在 NestedScrollView 中使用 RecyclerView?设置适配器后 RecyclerView 内容不可见。
无论如何,我已经尝试在 NestedScrollView 中使用 RecyclerView,方法是添加一个像 framelayout 或 relativelayout 这样的视图组作为 nestedscrollview 的单个子项,然后我在 framelayout 或 relativelayout 中添加了一个 recyclerview)
在此先感谢...
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/appbar"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/profile_bg_clound"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp">
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_driverRequests"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
【问题讨论】:
标签: android android-recyclerview scrollview android-nestedscrollview nestedscrollview