I have a RecyclerView
displaying items horizontally and I want to add spacing between each items(but not at the start or end). I found this and also looked at the example from the official docs and even though I have declared the variable using var I get the following error:
I have configured my recycler view as follows:
myRecyclerView.apply {
layoutManager = myLayoutManager
adapter = myAdapter(data)
addItemDecoration(divider)
}
It compiles and runs when I remove the line where I set my custom drawable. Why am I getting this error and how do you set a custom drawable?