as i have seen in different answers in stack about sectionned recyclerview , i did not found the right answer for my problem, i have an adapter with two view holders , the first viewholder is Category and the other view holder is Items, the problem is i have lot of items in one category and i want to present it as Horizontal LinearLayout , i have tried many solution but i cant find the right way.
enter image description here
class CustomAdapter(
var context: HomeFragment, retrofitData: ArrayList<Movdata>,
private var OnClickInterface: OnClickInterface
)
: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val TYPE_SECTION = 0
private val TYPE_MOVIE = 1
....
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int) = when (i) {
TYPE_SECTION -> SectionViewHolder(viewGroup.inflate(R.layout.section_header))
TYPE_MOVIE -> ItemViewHolder(viewGroup.inflate(R.layout.item_list))
else -> ItemViewHolder(viewGroup.inflate(R.layout.error_xml))
}
....
override fun getItemViewType(position: Int) = when (retrofitData[position]) {
is RecyclerItem.Genres -> TYPE_SECTION
is RecyclerItem.Item -> TYPE_MOVIE
}
....
my code work perfectly , but i dont know or how to make the horizontal linear in my recyclerview for each category ?
question from:
https://stackoverflow.com/questions/65882358/sectioned-recyclerview-with-horizontal-and-vertical-linear 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…