Reputation: 721
this is my xml file which add border around linear layout how do i add gradient color effect code inthis code? i want replace this color #C0C0C0 with gradiend color
below is my code
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<item
android:left="1dp"
android:right="1dp"
android:top="2dp"
android:bottom="2dp" >
<shape android:shape="rectangle">
<solid android:color="#C0C0C0" />
</shape>
</item>
</layer-list>
i want to add this code in my border .xml file how i merge??
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#fefdfe"
android:endColor="#e8e3ec"
android:angle="90" />
</shape>
Upvotes: 0
Views: 2931
Reputation: 3418
fill layout with gradient:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="#4fc939"
android:centerColor="#0c87c5"
android:endColor="#b4ec51"
android:angle="180" />
</shape>
</item>
Upvotes: 1
Reputation: 1844
Try this:-
<shape android:shape="rectangle">
<gradient
android:startColor="#5a5a5a88"
android:endColor="#14141488"
android:angle="270" android:centerX="0.25"/>
</shape>
Upvotes: 0
Reputation: 1818
Just replace
<shape android:shape="rectangle">
<solid android:color="#C0C0C0" />
</shape>
with your gradient shape.
Upvotes: 0