I have tried shadowing the list view i can make all the four sides.. but what i need here to shadow only the left and right corners of the list view like one in the given below image:
Asked
Active
Viewed 1,062 times
1
-
use 9 patch image – Avinash kumawat Dec 23 '16 at 10:17
-
what is the use of 9 patch image? am sorry am not aware of it.. suggest me what you know and let me also browse.. – Rishu Dec 23 '16 at 10:42
-
i just browsed what is 9 patch image.. i think it won't work out for me since am want this shadow effect in my dynamically generated list view – Rishu Dec 23 '16 at 10:45
-
http://stackoverflow.com/a/31722183/3303075 TAke a look at this example – Nilay Dani Dec 23 '16 at 11:01
2 Answers
1
I think you can use a covering way.The foreground layer is covered on the background layer and sets the padding of the foreground layer to expose the background layer only to the gradient edge.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- layout background -->
<item>
<!-- show rectangle area -->
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:startColor="#FFFFFF"
android:centerColor="#000000"
android:endColor="#FFFFFF"/>
</shape>
</item>
<!-- layout foreground -->
<item
android:bottom="5px"
android:top="5px">
<!-- show rectangle area -->
<shape android:shape="rectangle" >
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
You can also use Layer-List
specific reference SDK doc

LittleMice
- 11
- 2
-
Hey thanks for your xml @LittleMice i got what i want.. and thanks all for your help..!! – Rishu Dec 23 '16 at 13:18
-
0
I Would suggest you create a drawable as per your requirement and add it to the bottom of the view.

qwertygamer
- 130
- 8
-
Its kind of like a hack. But It Worked for me. when i wanted use a shadow effect in tabs – qwertygamer Dec 23 '16 at 11:31