Alex
Alex

Reputation: 8991

change gradient colour at end of ListView

On the Google Nexus S, when one tries to drag past the end of a ListView, a yellow gradient appears, and its size is determined by the distance dragged. How does one change the colour of this gradient? I cannot see anything obvious.

It is not cacheColorHint.

Upvotes: 3

Views: 1489

Answers (1)

Mark Allison
Mark Allison

Reputation: 21909

It appears to be hard-coded in the ScrollView implementation. Have a look at this, the setOverScrollMode() method on line 1389 (the exact line number may change if someone updates the source):

@Override
 public void setOverScrollMode(int mode) {
     if (mode != OVER_SCROLL_NEVER) {
         if (mEdgeGlowTop == null) {
             final Resources res = getContext().getResources();
             final Drawable edge = res.getDrawable(R.drawable.overscroll_edge);
             final Drawable glow = res.getDrawable(R.drawable.overscroll_glow);
             mEdgeGlowTop = new EdgeGlow(edge, glow);
             mEdgeGlowBottom = new EdgeGlow(edge, glow);
         }
     } else {
         mEdgeGlowTop = null;
         mEdgeGlowBottom = null;
     }
     super.setOverScrollMode(mode);
 }

The only way that I can see is to define your own ScrollView implementation, override setOverScrollMode() to use your own drawables, and then implent your own ListView which will use your ScrollView implementation instead of the standard one.

Upvotes: 2

Related Questions