What is the preferred way of loading an icon into ...
# compose
r
What is the preferred way of loading an icon into a
FloatingActionButton
?
a
* @param content the content of this FAB - this is typically an [Icon].
r
I have a drawable xml icon that I want to load but it seems I can't do that with
imageResource()
k
I think you might want to use
vectorResource
for that
r
I don't see an overload of
Icon
composable which accepts the
ImageVector
produced from
vectorResource
k
Which compose version are you using?
r
alpha08
a
👍 1
k
Check whether the parameter name being changed to
asset
a
Copy code
FloatingActionButton(
    modifier = modifier
        .padding(FabPadding)
        .align(Alignment.BottomEnd),
    onClick = onClick
) {
    Icon(imageVector = vectorResource(id = R.drawable.ic_add))
}
@allan.conda Why do you wrap ImageVector in a VectorPainter?
a
I don’t, that’s official API
that’s the method you called in your code
a
Oh 😄