I want to make a Button
like this one :
I try it using style
with shapeAppearance
:
<style name="ShapeAppearance.Button" parent="ShapeAppearance.MaterialComponents">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopLeft">@dimen/button_corner_radius</item>
<item name="cornerSizeTopRight">5dp</item>
<item name="cornerSizeBottomRight">@dimen/button_corner_radius</item>
<item name="cornerSizeBottomLeft">5dp</item>
</style>
<dimen name="button_corner_radius">40dp</dimen>
I apply the style in my MaterialButton like this :
app:shapeAppearance="@style/ShapeAppearance.Button"
The result is :
Now, I try to put a linear gradient :
- #DF2D48 @ 0.0
- #D72D46 @ 0.2
- #AF223B @ 0.5
- #AC2139 @ 1.0
For example :
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#DF2D48"
android:centerColor="#D72D46"
android:endColor="#AC2139"
android:angle="360" />
</shape>
and I apply it using in my Shape style :
<item name="android:background">@drawable/test</item>
But the result is the same. Why ?