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

Sam

10/08/2020, 11:21 PM
What’s the best way to create a
Button
with a
LinearGradient
for the background? I see that the Button composable is not that hard to recreate, but internally using a
Surface
which takes a
Color
. Does this mean I have to recreate both
Surface
and it’s private composable
SurfaceLayout
to achieve a gradient background?
i

Ian Lake

10/08/2020, 11:42 PM
Button
is part of
compose-material
and it sounds like you're deviating from what material allows. You might want to take a look at the Jetsnack sample, which has gradient buttons: https://github.com/android/compose-samples/tree/main/Jetsnack
2 Views