3
我正在制作应用程序以显示1视图中的所有产品。我想recyclerview显示所有项目并且不能滚动,只需滚动父视图(ScrollView)即可。但问题是无法使回收站的高度包裹所有内容。如何让recyclerview显示所有项目并且不能滚动
这是我的代码:
<TextView
android:text="Best seller:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView4"
android:textColor="#3f3f3f"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:scrollbars="horizontal"
android:id="@+id/rv_bestSeller"
android:layout_height="200dp" />
<TextView
android:text="New Product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView5"
android:textSize="18sp"
android:textColor="#3f3f3f" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:scrollbars="horizontal"
android:layout_height="200dp"
android:id="@+id/rv_newProduct"/>
<TextView
android:text="All Product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView6"
android:textSize="18sp"
android:textColor="#3f3f3f" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rv_allProduct" />
</LinearLayout>
</ScrollView>
nestedscrollview解决我的问题 –
使用setNestedScrollingEnabled (假); – yanivtwin
NestedScrollView和setNestedScrollingEnabled(false)修复了它。竖起大拇指。愿原力与你同在。 – ralphgabb