Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

android viewholder - Sectioned Recyclerview with horizontal and vertical linear

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...