嵌套的RecyclerView展开/折叠功能未响应

问题描述

我里面有2个RecyclerView(垂直)。 RecyclerView的外部具有子项列表,而在此Inner内,RecyclerView具有特定子项可用的设备列表。 内部RecyclerView有一个条件,即它应该第一次显示2个项目,并且这些对象在此按钮上都有一个按钮,单击该内部RecyclerView的整个列表对于特定的位置(子代)将可见。 我已经轻松实现了上述方案,但遇到了2个问题:

  1. 在“外部回收站视图”项目中单击-仅扩展最后一个位置的项目,单击其他位置则保持折叠状态。
  2. 滚动后,展开的视图会自动折叠。

下面我分享了我的代码

  1. 将完整的子级列表发送到外部适配器。

    adapterHomeChildList.setList(responseChildList); //将列表发送到适配器。

2。设置列表功能和外部适配器的BindViewHolder

public void setList(List<UserWithDeviceListResponse> mChildLists) {
    childLists = new ArrayList<>();
    childLists = mChildLists;

    notifyDataSetChanged();
}

onBindViewHolder(....)

AdapterHomeDeviceList adapterHomeDeviceList = new AdapterHomeDeviceList(context);
    adapterHomeChildListBinding.setAdapter(adapterHomeDeviceList); // set inner device list adapter

    if (childLists.get(position).getDeviceList() != null && !childLists.get(position).getDeviceList().isEmpty()) {
        if (childLists.get(position).isExpanded()) {
            adapterHomeChildListBinding.setIsSeeMore(false);  // set see more button visibility
            adapterHomeDeviceList.setList(childLists.get(position).getDeviceList());
        } else {
            if (childLists.get(position).getDeviceList().size() > 2) {
                adapterHomeChildListBinding.setIsSeeMore(true);
                filter(childLists.get(position).getDeviceList(),adapterHomeDeviceList); // show top 2 item only
            } else {
                adapterHomeDeviceList.setList(childLists.get(position).getDeviceList());
            }
        }
    }
  1. 项目点击界面句柄

    private void setRecyclerViewExpanding(int position){ for(int i = 0; i

搜索了很多与此相关的问题,但是大多数答案都使用可扩展列表视图,但我没有使用可扩展视图。 请帮帮我。 任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)