简体   繁体   中英

Using fragments as items in RecycleView

I googled this answer but didn't find something for me.

I want to use fragments (two different fragments) as items on RecycleView.

If you know how I can do it please help me. Thanks.

Create an interface and use it as your generic type of your RecyclerView and Adapter. Your item's layout will be this interface. And finally your fragments implements this interface.

Note: Fragments may cause irregularity since they are attached activity. Not preferred!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM