17

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

Natasha
  • 973
  • 9
  • 24
  • I'm not sure I understand what you need, but why not use a gradient that goes from fully transparent to opaque black with a height of e.g. 4dp? – npace Oct 28 '16 at 08:16
  • @npace because I have not solid screen background and this solution leads to shadow effect (like on second image and here you can see it better http://screencast.com/t/njDZjBkF3la). It has the same color with screen background on right and left side of list but different color on list center. – Natasha Oct 28 '16 at 08:24
  • @npace I need flat page effect but smooth item disappearance. – Natasha Oct 28 '16 at 08:26
  • @DeeV but near the left and right border you get 14141d (or near) – Natasha Nov 01 '16 at 14:50

1 Answers1

22

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 
/>
dardan.g
  • 689
  • 7
  • 17