https://kotlinlang.org logo
#compose
Title
# compose
i

izyaboi

02/24/2021, 1:51 PM
one question ! How can i use my own imported svg in a icon?
Copy code
Icon(
    imageVector = Icons.Default.PlayArrow,
    modifier = Modifier.padding(8.dp),
    contentDescription = null,
)
but i want the pause icon from the material icon without to import the whole lib ? how can i get a ImageVector from painterResource?
b

Bryan Herbst

02/24/2021, 1:53 PM
You can use
Icon
with a painterResource directly-
Copy code
Icon(
   painter = painterResource(R.drawable.ic_material_pause),
   modifier = Modifier.padding(8.dp),
   contentDescription = null
)
i

izyaboi

02/24/2021, 1:54 PM
i know but
Copy code
imageVector = painterResource(id = R.drawable.pause),
intellj said found pointer
how can i make the pointer as ImageVector
s

Se7eN

02/24/2021, 1:55 PM
Change
imageVector
to `painter`:
Copy code
painter = painterResource(id = R.drawable.pause),
👍 1
d

Desmond Teo

02/24/2021, 1:56 PM
Copy code
painter = painterResource()
instead of
Copy code
imageVector = painterResource()
👍 2
i

izyaboi

02/24/2021, 1:56 PM
oh man thx haha
what a stupid mistake haha