Computer scienceMobileAndroidUser InterfaceGraphics

ItemDecoration

Applying decorations

Report a typo

Complete the missing parts so that you can apply the OffsetItemDecoration(spacingInDp: Int) to the recycler view.

Fill in the gaps with the relevant elements
class MainActivity :  {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val recycler = findViewById<>(R.id.recycler_view)
        val offsetSizeInDp = resources.(R.dimen.offsets)
        recycler.adapter = ItemRecyclerAdapter()
        recycler.layoutManager = LinearLayoutManager(this)
        recycler.(OffsetItemDecoration(offsetSizeInDp))
    }
}
FragmentActivity()RecyclerViewaddItemDecorationgetDimensionPixelSizeAppCompatActivity()

Create a free account to access the full topic