android - define top and bottom shadow to view -


i'm trying create background via xml should this:

a solid white background gradient on top , bottom of view show dropshadow.

i know can create using multiple views , create drawable background each of them think there might better solution that!?

i tried use layer-list because cant set 'heigh' and/or 'alignparentbottom' or alpha of gradient can't see shadow...

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">      <!-- drop shadow stack -->     <item android:bottom="15dp">         <shape>             <gradient                 android:centercolor="#000"                 android:endcolor="#0000"                 android:angle="90"/>         </shape>     </item>      <!-- base background -->     <item android:bottom="15dp" android:top="15dp">         <shape android:shape="rectangle">             <solid android:color="#fff"/>          </shape>     </item>  </layer-list> 

maybe out there got idea of mean , maybe solution too!?

i found solution me work.

it draws line on top , 5dp gradient on bottom.

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">      <!-- drop shadow stack -->     <item>         <shape>             <gradient                 android:centercolor="#d5e2ed"                 android:endcolor="#0000"                 android:angle="90"/>         </shape>     </item>      <item android:bottom="10dp">         <shape>             <padding android:top="1dp"/>             <solid android:color="#d5e2ed"/>         </shape>     </item>      <!-- base background -->     <item android:bottom="5dp" android:top="1dp">         <shape android:shape="rectangle">             <solid android:color="#fff"/>             <padding android:bottom="10dp" android:top="10dp"/>         </shape>     </item>  </layer-list> 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -