我有一个xml布局,有以下意见Scrollview-> RelativeLayout->一些视图+ Tablayout + ViewPager-> Recylerview(在ViewPager的片段)。 ViewPager有一些固定的高度(保持它“Wrap_Content”根本不显示它)。现在问题是Recylerview从不滚动。我已经尝试了几种解决方案,如“嵌套滚动视图”或甚至让子LinearLayout已经发布像Wraping viewpager。但没有工作。Recyclerview里面的ViewPager滚动视图不工作
下面是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_startdraw"
android:fillViewport="true"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="@dimen/_5sdp">
<TextView
android:id="@+id/invites_accepted"
style="@style/bodyStyleBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/committee_slots"
android:text="@string/invites_accepted" />
<!-- A lot of other Textfields for data display-->
<android.support.design.widget.TabLayout
android:id="@+id/tabs_pendingcommittee"
style="@style/TabStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/draw_mode_val"
app:tabMode="fixed"></android.support.design.widget.TabLayout>b
<com.apponative.committeeapp.ui.custom.CustomViewPager
android:id="@+id/pending_member_view"
android:layout_width="match_parent"
android:layout_height="@dimen/_250sdp"
android:layout_below="@+id/tabs_pendingcommittee"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<!-- Some other views on bottom-->
</RelativeLayout>
而且片段Viewpager是显示具有以下布局的xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<TextView
style="@style/bodyStyleBold1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="No People..." />
<android.support.v7.widget.RecyclerView
android:id="@+id/contact_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:background="@color/white"></android.support.v7.widget.RecyclerView>
</FrameLayout>
我一直在使用nestedScrollingEnabled尝试和Recyclerview也setFixedHeight性能。但是没有任何工作。
我想你应该从相对布局回收视图本身有自己的滚动删除滚动视图。 –
@RounakLahoti我的布局有很多需要滚动的视图。我没有为该RecyclerView使用srollview。 Recylerview也是布局中的一个子元素,它在其他视图旁边显示另一个数据列表(TextView,ImageView,EditView的组合)。 –