Issue
I want to accomplish the exact effect on the button background, but not successful yet..! any help?
Here's the image
My attempt so far (gradient_bg.xml)
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="@android:color/transparent"
android:startColor="#e3ffffff" />
</shape>
..and the result not so much..!
The layout
<TextView
fontPath="fonts/Roboto-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginBottom="-20dp"
android:gravity="start"
android:text="@string/dummy_big"
android:textColor="@color/gray_dark"
android:textSize="13sp"
tools:ignore="MissingPrefix" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_bg">
<Button
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="120dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="120dp"
android:layout_marginBottom="20dp"
android:background="@drawable/round_solid_primary"
android:clickable="true"
android:foreground="?selectableItemBackground"
android:gravity="center_vertical|center_horizontal"
android:text="@string/view_more"
android:textColor="@color/ef_white"
android:textSize="15sp"
tools:ignore="MissingPrefix" />
</FrameLayout>
Solution
Try below code may help you to solve your problem
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#ffffff"
android:centerColor="#90ffffff"
android:startColor="#65ffffff"
android:angle="-90"/>
</shape>
Answered By - tj2611
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.