Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 265
Mo Dev Avatar asked Sep 01 '19 10:09

Mo Dev


People also ask

How do I change transparency on Android?

setAlpha(51); Here you can set the opacity between 0 (fully transparent) to 255 (completely opaque). The 51 is exactly the 20% you want.

How do I make white background transparent in Android?

For all the Android and iPhone users out there, Apowersoft Background Eraser is the app that can create white background to transparent. This app will automatically get rid background with zero taps. No doubt that you will get a genuine all-in-one photo background editor. Download and install the app on your phone.

How do I make Constraintlayout transparent?

If you add this line to the Constraint Layout xml it will become transparent: android:background="@android:color/transparent" . This will make the background see through and show what ever is bellow or overlapping.


1 Answers

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"

like image 81
Shariq Shaikh Avatar answered Oct 01 '22 21:10

Shariq Shaikh