Closed leopku closed 4 years ago
Hi, @leopku
In that case, you should use the RecyclerView
with LinearLayour
, and add a second RecyclerView
with GridLayoutManager
in the item layout. (not section's header layout).
Here is some examples using SampleAdapter and SampleViewHolder.
override fun layout(sectionRow: SectionRow): Int {
when (sectionRow.row) {
0 -> return R.layout.item_sample1_header
else -> return R.layout.item_sample
}
}
The R.layout.item_sample
shoud be like below.
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
Make a new adapter and viewholder for the grid item. (ItemDetailAdapter, ItemDetailViewHolder).
After that, here is an example of the SampleViewHolder.
itemView.run {
recyclerView.adapter = ItemDetailAdapter()
recyclerView.layoutManager = GridLayoutManager(context(), 3)
// add items
}
Thank you for your issue :)
Awesome. It works. Thank you @skydoves .
@leopku Have a nice day! 😄
Is your feature request related to a problem? Thanks for your many useful projects.
I wanna apply GridLayoutManager like below:
If using GridLayoutMananger directly, result would like below:
Any idea about it?
A clear and concise description of what the problem is.
Describe the solution you'd like:
A clear and concise description of what you want to happen.
Describe alternatives you've considered:
A clear description of any alternative solutions you've considered.