【发布时间】:2018-10-30 03:39:32
【问题描述】:
我正在使用 recyclerview 和 GridLayoutManager 在 textView 中显示文本。我想显示这些项目,如图 1 所示。 应用程序的要求是在此处输入图像描述如果 textview 需要 2 行来显示设置的列数为 1,否则将其设为 2。 我尝试使用下面链接中的 GridAutoFitLayoutManager.java,但它没有用。 https://gist.github.com/omidraha/af3aa017d4ec06342bdc03c49d4b83b1
到目前为止,我已将列数设置为 2。下面是我的代码 hotAdapter=新的 HotAdapter(this,hotItems,this); hotRecyclerView.setAdapter(hotAdapter);
GridLayoutManager gridLayoutManager=new GridLayoutManager(this,2);
hotRecyclerView.setLayoutManager(gridLayoutManager);
【问题讨论】:
标签: android android-recyclerview gridlayoutmanager