airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.46k stars 730 forks source link

I use ModelGroup to make expand and collapse animation, but it brings performance problem when I set layoutParams to the rootView in bind method #1318

Open nanfengkkkkkkk opened 1 year ago

nanfengkkkkkkk commented 1 year ago

abstract class VerticalExpandAnimModelGroup : GroupModel(R.layout.layout_vertical_expand_anim_model_group) {                               
    override fun bind(holder: ModelGroupHolder) {                                                                                  
            super.bind(holder)                                                                      
            val rootView = holder.rootView                                              
            if (!isExpand) {                                                  
                rootView.layoutParams.apply {                               
                    height = 0                                      
                }                                                      
            } else {                                                   
                setWrapLayoutParams(rootView)                             
            }                                         
        }                             
}```