I need to create a 2D view in my Android Application. I tried this with recyclerview inside horizontal scroll view. But I need to create a heading for each item and have to scroll the heading with recyclerview scroll horizontally. Is it possible?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:background="@color/tablayoutbg">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:gravity="center"
android:textSize="16sp"
android:text="Sl.No"/>
<TextView
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
<TextView
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
<TextView
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
<TextView
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
<TextView
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
<TextView
android:id="@+id/msubtitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/white"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center|left"
android:textSize="16sp"/>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/ScrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:fillViewport="true"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/RecyclerView"
android:layout_width="fill_parent"
android:layout_height="match_parent"/>
</HorizontalScrollView>
you can use nested recyclerview to solve your issue. In the parent recyclerview item take a layout and here set a header for each recyclerview
为什么要在水平滚动视图中放置回收器视图?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.