Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How add item transparency inside RecyclerView when it's out of list border?

How make RecyclerView item disappear smoothly when it is going out of list border? See image below. All possible solutions highly appreciated!

enter image description here

Note: Solution with View above RecyclerView which has gradient background (shadow imitation) does not work well because I have gradient background on screen and it is difficult to match that "shadow" view background to screen background and it look like that:enter image description here

So, works like shadow not like disappearance.

UPDATED: Got the second screen with following background:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <gradient
        android:type="linear"
        android:startColor="#FF14141d"
        android:endColor="#0014141d"
        android:angle="270"/>
</shape>

Here is original screen background

enter image description here

like image 488
Natasha Avatar asked Oct 28 '16 08:10

Natasha


1 Answers

if you want to fade edges, you can use:

 <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:requiresFadingEdge="vertical" <-- this line
        android:fadingEdgeLength="150dp" <-- this line, the height of fade 
/>
like image 144
d.gjinovci Avatar answered Sep 17 '22 22:09

d.gjinovci