我需要完全禁用listview中的过度滚动,这样我就可以实现自己的过度滚动功能.
通过将overscroll模式设置为OVERSCROLL_NEVER ,在查看核心listview类时似乎很简单.这个很好的工作在我的三星Galaxy s2上.但不起作用Galaxy Tab 2.3.3.
有没有人对三星ListView自定义有很多经验可以帮助我?
小智 3
它在 Samsung Galaxy Tab(Android 2.2)上对我有用:
try {
// list you want to disable overscroll
// replace 'R.id.services' with your list id
ListView listView = ((ListView)findViewById(R.id.services));
// find the method
Method setEnableExcessScroll =
listView.getClass().getMethod("setEnableExcessScroll", Boolean.TYPE);
// call the method with parameter set to false
setEnableExcessScroll.invoke(listView, Boolean.valueOf(false));
}
catch (SecurityException e) {}
catch (NoSuchMethodException e) {}
catch (IllegalArgumentException e) {}
catch (IllegalAccessException e) {}
catch (InvocationTargetException e) {}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1798 次 |
| 最近记录: |