Closed dbof10 closed 5 years ago
Hi @dbof10 ,
if I got you right, you can use onBind to set a background color for your carousel.
carousel {
id(Model.TAG + "carousel")
onBind { _, view, _ ->
view.setBackgroundColor(ContextCompat.getColor(activity!!, R.color.YOUR_COLOR))
}
withModelsFrom(...) { ... ->
// your models here
}
}
I hope this answer your question!
while it works, I don't recommend using the onBind
callback to style views. View styling should be done within the view, or with something like Paris (https://github.com/airbnb/epoxy/wiki/Paris-Integration-(Dynamic-Styling)).
In terms of carousels and color styling go though, this is no different from how a normal recyclerview works. a model's bind
function is equivalent to a vanilla RecyclerView adapter's onBindViewHolder, and all styling can be done there
This is my Carousel. Is the any way to set background color instead of setting its parent view?