user2589245 user2589245 - 27 days ago 17
Android Question

how to add gradient effect in layout border xml file

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>

Answer

Just replace

<shape android:shape="rectangle"> 
    <solid android:color="#C0C0C0" />
</shape>

with your gradient shape.

Comments