【问题标题】:How could a make a view like that with RecyclerView?我怎么能用 RecyclerView 制作这样的视图?
【发布时间】:2017-05-03 06:23:34
【问题描述】:

我希望RecyclerView 看起来像这样:

我该怎么做?

【问题讨论】:

标签: android android-layout android-recyclerview


【解决方案1】:

与 GridLayoutManager 一起使用,例如:

private RecyclerView.LayoutManager mLayoutManager;
mLayoutManager = new GridLayoutManager(mContext, 10);
holder.recycler_viewGv.setLayoutManager(mLayoutManager);

并尝试使用此链接突出显示Highlighting center item

【讨论】:

    【解决方案2】:

    我建议您可以尝试使用这种方法并根据需要进行更改

    compile 'com.github.gastricspark:scrolldatepicker:0.0.1'
    

    https://github.com/GastricSpark/ScrollDatePicker

    https://github.com/hrules6872/HorizontalNumberPicker

    <com.harrywhewell.scrolldatepicker.DayScrollDatePicker
        android:id="@+id/day_date_picker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    

    【讨论】:

    • 实际上我想要完全相同的视图。例如:所选项目突出显示,其余部分模糊。
    【解决方案3】:

    这与您要查找的内容不完全相同,但可能会给您一些提示。 将 RecyclerView 与水平布局管理器一起使用。 修改你的适配器类 在 onBindViewHolder 中,根据位置更改您的 textview 大小

          if(position == mid of list){
           //Increase the text size 
          }else{
          //set the normal size to text view 
          }
    

    ...

    【讨论】:

      猜你喜欢
      • 2020-04-12
      • 2023-03-23
      • 1970-01-01
      • 2017-07-06
      • 2016-06-04
      • 2020-10-27
      • 2012-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多