Search code examples
androidandroid-imageviewandroid-drawable

How to add a fully transparent to semi-transparent gradient in Android


I have a situation where I want to add an image view doing the same effect as this app

Screenshot

As you notice there is a drawable or something hiding the bottom side of the view adding a transparent gradient. How can I achieve the same effect?


Solution

  • Well, you can use fadingEdge attribute of the listView in your xml. Make a listView, then add items xml (images in particular as you've mentioned above).

    android:fadingEdge="horizontal" android:fadingEdgeLength="30dp" android:fillViewport="false" android:requiresFadingEdge="vertical"