Listview uses overscroll to solve the problem of shadow and custom pattern on the border when pulling up and down. listviewoverscroll
The following code must be available after 2.3 .. Now it's almost over 2.3 ..
Http://blog.csdn.net/wanghao200906/article/details/42004007
First, let's take a look at the default listview drop-down.
This is the Blue Shadow part. Let's talk about how to remove him first .. You can use only one line of code.
play_listview.setOverScrollMode(android.view.View.OVER_SCROLL_NEVER);
In this way, you can remove the shadow ..
Next we will introduce some high-end products .. Change the Blue Shadow and program the Blue Shadow ..
You can directly use the following methods ..
@ SuppressWarnings ("deprecation") public void setEdge (ListView lv) throws Exception, IllegalAccessException {Class <?> C = (Class <?>) Class. forName (AbsListView. class. getName (); Field egtField = c. getDeclaredField ("mEdgeGlowTop"); Field egbBottom = c. getDeclaredField ("mEdgeGlowBottom"); egtField. setAccessible (true); egbBottom. setAccessible (true); Object egtObject = egtField. get (lv); // this indicates the ListiVew Instance Object egbObject = egbBottom. get (lv); // egtObject. getClass () is actually an EdgeEffect with two important attributes: mGlow mEdge // and both attributes are Drawable Class <?> Cc = (Class <?>) Class. forName (egtObject. getClass (). getName (); Field mGlow = cc. getDeclaredField ("mGlow"); mGlow. setAccessible (true); mGlow. set (egbObject, new ColorDrawable (Color. RED); mGlow. set (egtObject, this. getResources (). getDrawable (R. drawable. ic_launcher); // mGlow. setBoolean (egtObject, false); // cancel displaying Field mEdge = cc. getDeclaredField ("mEdge"); mEdge. setAccessible (true); mEdge. set (egtObject, new ColorDrawable (Color. RED); mEdge. set (egbObject, new ColorDrawable (Color. RED ));}
Upload the listview. You can .. Note that there are two parameters.
Two layers can be found whether sliding down or sliding up ..
The above layer of mGlow
The lower layer of mEdge ..
In this way, the effect can be achieved ..