Reputation: 113
I have a drawable resource and I want to use it as a background color for my lazy column items.
Code:
@Composable
fun HabitItem(
habit: Habit,
onDeleteClick: () -> Unit,
navController: NavHostController
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
.background(//I want to place the drawable resource here)
) {
Any help?
Note: The purpose of using drawable resource instead of a color is that I want to add corner radius to the items. So if there is a way to add a corner radius without drawable that will work as well.
Upvotes: 2
Views: 1077
Reputation: 31
You can replace .background
with .paint
inside your Row
Something like that:
Row(
modifier = Modifier.fillMaxWidth()
.padding(8.dp)
.paint(
painter = painterResource(
id = R.drawable.ic_name
)
)
) {}
Upvotes: 1