标签:
方法一 通过反射:
代码:
Class clsClass = listView.getClass().getSuperclass(); if(clsClass == null){ Log.d("tag", "null"); }else { Log.d("tag", "not null"); if(clsClass == AbsListView.class){ Log.d("tag", "AbsListView"); try { Field minField = AbsListView.class.getDeclaredField("mMinimumVelocity"); Field maxField = AbsListView.class.getDeclaredField("mMaximumVelocity"); minField.setAccessible(true); maxField.setAccessible(true); try { Log.d("tag", "min:" + minField.get(listView)); Log.d("tag", "max:" + maxField.get(listView)); maxField.set(listView, 2000); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } }else { Log.d("tag", "not AbsListView"); } }
mMinimumVelocity是滑动最小速度,
mMaximumVelocity是滑动的最大速度
标签:
原文地址:http://my.oschina.net/u/2250759/blog/365040