如何并排显示回收者视图项目 [英] How to display recycler view items side by side

查看:102
本文介绍了如何并排显示回收者视图项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何并排显示 RecyclerView 项目.我试图通过使用 FlowLayoutManager FlexboxLayoutManager 来做到这一点,但是它仅以列表格式显示,这里是带有 FlowLayoutManager 的代码:

How can we display RecyclerView items side by side. i tried to do this by using FlowLayoutManager and FlexboxLayoutManager but it is showing in list format only here is the code with FlowLayoutManager:

  FlowLayoutManager flowLayoutManager = new FlowLayoutManager();
  flowLayoutManager.setAutoMeasureEnabled(true);
    listView.setLayoutManager(flowLayoutManager);

    madapter = new testingAdapter(Quran_e_Kareem.this,surah1);
    listView.setAdapter(madapter); 

这是FlexboxLayoutManager的代码:

here is the code with FlexboxLayoutManager:

    FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(getApplicationContext());
    //         Set flex direction.
    flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
    flexboxLayoutManager.setFlexWrap(FlexWrap.WRAP);
    flexboxLayoutManager.setAlignItems(AlignItems.FLEX_START);
    flexboxLayoutManager.setJustifyContent(JustifyContent.FLEX_START);
    listView.setLayoutManager(flexboxLayoutManager);

madapter = new testingAdapter(Quran_e_Kareem.this,surah1);
listView.setAdapter(madapter);

我正在获得结果列表

但是我想这样

感谢您的帮助.

推荐答案

使用ChipsLayoutManager使用以下lib可以帮助我做同样的事情

Use ChipsLayoutManager use following lib helps me to do same

 implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'

这篇关于如何并排显示回收者视图项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆