kongnanlive / StickyHeaderScrollView

支持吸顶Sticky,滚动布局NestedScrollView嵌套RecyclerView,解决CoordinatorLayout、AppBarLayout快速滑动fling停住卡住回弹抖动等bug
111 stars 14 forks source link

header移除bug #8

Closed daydreamnist closed 2 years ago

daydreamnist commented 2 years ago

当StickyLinearLayout中只有一个sticky控件且被移除时,minimumHeight 会被保留,没有重置

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)
        for (i in childCount - 1 downTo 0) {
            val child = getChildAt(i)
            if ((child.layoutParams as LayoutParams).isSticky) {
                minimumHeight = child.measuredHeight
                break
            }
        }
    }
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)
        var minHeight = 0
        for (i in childCount - 1 downTo 0) {
            val child = getChildAt(i)
            if ((child.layoutParams as LayoutParams).isSticky) {
                minHeight = child.measuredHeight
                break
            }
        }
        minimumHeight = minHeight
    }
kongnanlive commented 2 years ago

感谢。已更新。