Computer scienceMobileAndroidUser InterfaceGraphics

ItemDecoration

Add an icon

Report a typo

Organize your code in such a way that, upon adding this decoration to the RecyclerView, the icon gets rendered.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                iconDrawable.draw(c)
              
                for (i in 0 until parent.childCount) {
              
                child.left + iconSizeInDp, child.top + iconSizeInDp
              
                val child = parent.getChildAt(i)
              
                }
              
                override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
              
                }
              
                }
              
                class IconItemDecoration(private val iconDrawable: Drawable, private val iconSizeInDp: Int) : RecyclerView.ItemDecoration() {
              
                iconDrawable.setBounds(
              
                child.left, child.top,
              
                )
              

Create a free account to access the full topic