[fix]
[站点4个高度100]
This commit is contained in:
yangyakun
2025-06-19 11:09:41 +08:00
parent 732f2fcccb
commit 49c678949b

View File

@@ -15,8 +15,14 @@ class ItemDecoration() : RecyclerView.ItemDecoration() {
outRect: Rect, view: View,
parent: RecyclerView, state: RecyclerView.State
) {
if((parent.adapter?.itemCount ?: 4) < 4){
val height = AutoSizeUtils.dp2px(parent.context,140f)
if((parent.adapter?.itemCount ?: 4) < 4) {
val height = AutoSizeUtils.dp2px(parent.context, 140f)
val layoutParams = view.layoutParams as RecyclerView.LayoutParams
layoutParams.height = height
view.layoutParams = layoutParams
}else if((parent.adapter?.itemCount ?: 4) == 4){
val height = AutoSizeUtils.dp2px(parent.context, 100f)
val layoutParams = view.layoutParams as RecyclerView.LayoutParams
layoutParams.height = height