Hi I am trying to get shadow like gradient only on the top using the shape.xml

From the image am wrapping the buttons in a linear layout and I want to give the gradient on top of the layout.
Am doing as below but it is not working out
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
      <shape 
        android:shape="rectangle">
            <stroke android:width="1dp" android:color="#f0f0f0" />
            <solid android:color="#f0f0f0" />
        </shape>
   </item>
   <item android:top="1dp"> 
      <shape 
        android:shape="line">
       <gradient
        android:angle="90"
        android:type="linear"
        android:startColor="#FFFFFF"
        android:endColor="#000000" />
        </shape>
   </item>
</layer-list>
                No need to use Layer-list , You can do it by Gradient. Try this flowing code ->
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#b4909090" android:endColor="#b4fafafa" android:angle="90"/>
</shape>
Change the startColor and endColor as you want. And the result is -> 

Simply use:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient 
  android:type="linear"
  android:centerX="78%" 
  android:startColor="#FFf7f7f7" 
  android:centerColor="#FFC0C0C0" 
  android:endColor="#FFbebebe" 
  android:angle="90"/>
</shape>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With