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

Cody Engel

10/24/2019, 4:25 AM
Has anyone gotten a
FloatingActionButton
to display an image yet? I feel like I’m missing something very simple…
Copy code
val resource = +vectorResource(R.drawable.ic_baseline_add)
        FloatingActionButton(icon = resource) // takes an Image instead of Vector, how does one convert a Vector to an Image with Compose?
a

Andrey Kulikov

10/24/2019, 9:35 AM
There is one more variant of FloatingActionButton with the compostable lamda as a last Param. with use of it you can emit any content. For example the vector image, so you would need a Container and DrawVector component, please take a look how it works in this example https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsActivity.kt