mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-26 22:26:29 +08:00
test RecyclerView alpha
This commit is contained in:
@@ -22,6 +22,7 @@ class GrayOverlayItemDecoration(private val context: Context) : RecyclerView.Ite
|
|||||||
for (i in 0 until childCount) {
|
for (i in 0 until childCount) {
|
||||||
val child = parent.getChildAt(i)
|
val child = parent.getChildAt(i)
|
||||||
if (!child.hasFocus()) {
|
if (!child.hasFocus()) {
|
||||||
|
// child.alpha = 0.7f
|
||||||
// 计算遮罩层的大小
|
// 计算遮罩层的大小
|
||||||
val overlayRect = Rect(
|
val overlayRect = Rect(
|
||||||
child.left,
|
child.left,
|
||||||
@@ -31,6 +32,8 @@ class GrayOverlayItemDecoration(private val context: Context) : RecyclerView.Ite
|
|||||||
)
|
)
|
||||||
// 绘制灰色遮罩层
|
// 绘制灰色遮罩层
|
||||||
c.drawRect(overlayRect, grayOverlayPaint)
|
c.drawRect(overlayRect, grayOverlayPaint)
|
||||||
|
} else {
|
||||||
|
// child.alpha = 1f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user