I have RecyclerView and I need next behavior:
class FooterViewHolder(private val parent: ViewGroup) {
...
fun bind(item: Item) {
...
itemView.post(::adjustTop)
}
private fun adjustTop() {
val parent = parent as RecyclerView
var topOffset = parent.height
for (child in parent.children) topOffset -= child.height
(itemView.layoutParams as ViewGroup.MarginLayoutParams)
.setMargins(0, topOffset.coerceAtLeast(0), 0, 0)
}
}