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
}
当StickyLinearLayout中只有一个sticky控件且被移除时,minimumHeight 会被保留,没有重置