Jake Wilson
Jake Wilson

Reputation: 91193

Android - alter Orange Gradient at top and bottom of scrollable Views?

In Android 2.3.x (and maybe previous versions?) when working with any scrollable Views, like a ListView or ScrollLayout, etc, when you reach the top or bottom of the list, a orange gradient appears to indicate that you are at the top or bottom of the list and can't scroll any farther. The gradient gets bigger as you try to scroll farther off the screen. I don't know what the name is of this type of widget in the SDK.

Anyways, how to do I alter it, change colors, get rid of it, etc?

Orange Gradient

Upvotes: 2

Views: 1411

Answers (2)

A.Quiroga
A.Quiroga

Reputation: 5722

Have a look at this

change gradient colour at end of ListView

Override setOverScrollMode method

@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);  }

Upvotes: 0

Related Questions