Nikhil
Nikhil

Reputation: 91

In a ListView, is it possible to only fade in elements from one edge?

I'm utilizing a simple listview and want to fade one edge, not two or four as I'm currently experiencing using:

<ListView
    android:id="@+id/main_feed"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:requiresFadingEdge="vertical"
    android:fadingEdgeLength="50dp" >
</ListView>

I want to only fade one edge (the bottom edge), but doing either 'vertical' or 'horizontal' in requiresFadingEdge fades top/bottom or left/right, respectively.

Any Suggestions?

Upvotes: 3

Views: 1445

Answers (1)

Ivar van Hartingsveldt
Ivar van Hartingsveldt

Reputation: 136

I know this is an old question, but I found a way to do this. Just make your own class that extends ListView and override the method getTopFadingStrength() like this:

@Override
protected float getTopFadingEdgeStrength() {
    return 0;
}

This will remove the fading on the top, but keep the fading on the bottom, then in your XML just use your ListView implementation.

Upvotes: 5

Related Questions