Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用CardArrayRecyclerViewAdapter. 具体来说,我有兴趣在标题后面跟着不同布局的卡片?
CardArrayRecyclerViewAdapter
的适配器RecyclerView有一个名为getItemViewType(). 该类型被传递给 'onCreateViewHolder()',因此您可以扩展不同的布局。
RecyclerView
getItemViewType()
因此,您只需要getItemViewType()根据要膨胀的每个布局覆盖并返回不同的值