CymChad / BaseRecyclerViewAdapterHelper

BRVAH:Powerful and flexible RecyclerAdapter
http://www.recyclerview.org/
MIT License
24.21k stars 5.14k forks source link

点击Item动画问题 #3738

Closed ChaoyuZhu closed 1 year ago

ChaoyuZhu commented 1 year ago

版本:'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.11' 操作:这个列表是选择列表,点中变颜色。然后运行的时候偶尔会出现点击当前Item其他Item变大或变小的问题,整个Item的大小都发生了变化。这不是必现,一般是第一次安装没问题,结束App重新运行会出现这个问题。 代码如下:

    shopCategoryAdapter = new ShopCategoryAdapter(R.layout.adapter_order_category_item, shopBean.getData().getCategory());
    viewBinding.recyclerShopCategory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    shopCategoryAdapter.setOnItemClickListener(this);
    viewBinding.recyclerShopCategory.setAdapter(shopCategoryAdapter);

    适配器中根据是否选择去改变背景色
    if (categoryBean.getIsSelect() == 1) {
        baseViewHolder.setBackgroundColor(R.id.tv_category_name, getContext().getColor(R.color.colorGrey));
    } else {
        baseViewHolder.setBackgroundColor(R.id.tv_category_name, getContext().getColor(R.color.white));
    }

    外面点击后改变值去刷新适配器notifyDataSetChanged
  1. gif复现效果

https://user-images.githubusercontent.com/108125238/223703961-914477fb-5b3e-4405-8cc2-72556f8d0a35.mp4

5.有大神知道如何解决么

limuyang2 commented 1 year ago

看这样子,不应该是本库的问题。如有疑虑,可以发送一个demo我试下

ChaoyuZhu commented 1 year ago

这个问题我到最后还是没发现是如何产生的,后来我换了2.9.50版本,然后整体页面UI重新调整了下,就没有再出现了。我也觉得不像是本库的问题,但是无从下手。

ChaoyuZhu commented 1 year ago

我只记得我当时页面布局用了DrawerLayout,然后页面有多个列表。哇,是真的很奇怪。