I am a beginner in creating applications in Android Studio and I am trying to recreate a background which has been made in Figma.
Background in Figma:
Properties:
Rotation: 179.7°
Fill: Linear Gradient
#23152C @ 0.0
#828F8893 @ 0.49
#00FFFFFF @ 1.0
Fill: Solid
#120A16
Effect: Drop Shadow
Radius: 4dp
Offset: 0dp, 4dp
#40000000
After trying multiple times to recreate the background in Android Studio, I figured out that the issue is that the colors do not overlap, the transparent white #00FFFFFF
should be replaced by the solid color #120A16
.
background.xml from drawables folder
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/solid_grad"/>
<gradient
android:startColor="@color/gradientStart"
android:centerColor="@color/gradientCenter"
android:endColor="@color/solid_grad"
android:type="linear"
android:angle="90" >
</gradient>
</shape>
colors.xml from values folder
<resources>
<color name="gradientStart">#23152C</color>
<color name="gradientCenter">#828F8893</color>
<color name="gradientEnd">#00FFFFFF</color>
<color name="solid_grad">#120A16</color>
</resources>
And the result:
Does anyone have any idea on how to overlap gradient with the solid color?
PS: I don't want to export the background from Figma and import it to Android due to the high variety of screen sizes and due to performance.