开发者社区> 问答> 正文

在fragment中用ScrollView嵌套RecyclerView

在fragment中用ScrollView嵌套RecyclerView 当只有2个RecyclerView时会很流畅,如果有3个就会很卡,是什么原因? 下面是代码:

<ScrollView
android:id="@+id/scroll_view"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".fragments.MainFragment">





       <LinearLayout
           android:orientation="vertical"
           android:layout_width="match_parent"
           android:layout_height="wrap_content">



           <TextView
               android:textColor="@color/blacker"
               android:textStyle="bold"
               android:textSize="18sp"
               android:text="Техника для офиса"
               android:layout_marginTop="20dp"
               android:layout_marginLeft="15dp"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_marginStart="15dp" />



           <android.support.v7.widget.RecyclerView
               android:nestedScrollingEnabled="false"
               android:fillViewport="true"
               android:layout_marginBottom="15dp"
               android:layout_marginTop="15dp"
               android:id="@+id/recyclerView_popular_goods"
               android:layout_width="wrap_content"
               android:layout_height="match_parent"/>



           <TextView
               android:textColor="@color/blacker"
               android:textStyle="bold"
               android:textSize="18sp"
               android:text="Компьютерная техника"
               android:layout_marginTop="20dp"
               android:layout_marginLeft="15dp"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_marginStart="15dp" />



           <android.support.v7.widget.RecyclerView
               android:nestedScrollingEnabled="false"
               android:fillViewport="true"
               android:layout_marginBottom="15dp"
               android:layout_marginTop="15dp"
               android:id="@+id/recyclerView_competitive_goods"
               android:layout_width="wrap_content"
               android:layout_height="match_parent"/>



           <TextView
               android:textColor="@color/blacker"
               android:textStyle="bold"
               android:textSize="18sp"
               android:text="Канцелярские товары"
               android:layout_marginTop="20dp"
               android:layout_marginLeft="15dp"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_marginStart="15dp" />



           <android.support.v7.widget.RecyclerView
               android:visibility="gone"
               android:fillViewport="true"
               android:layout_marginBottom="15dp"
               android:layout_marginTop="15dp"
               android:id="@+id/recyclerView_stationery_goods"
               android:layout_width="wrap_content"
               android:layout_height="match_parent"/>

       </LinearLayout>

展开
收起
1403297683414040 2019-11-15 14:14:47 663 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载