Android开发 ListView的OnScrollListener详解
来源:互联网 发布:淘宝2016全年交易额 编辑:程序博客网 时间:2024/05/24 02:49
OnScrollListener接口是定义在AbsListView中的,而AbsListView的直接子类有GridView和ListView,非直接子类有ExpandableListView。OnScrollListener的完整路径是frameworks\base\core\java\Android\widget\AbsListView.java
其源码如下:
/** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. */ public interface OnScrollListener { /** * The view is not scrolling. Note navigating the list using the trackball counts as * being in the idle state since these transitions are not animated. */ /*scrollState有三种状态,分别是SCROLL_STATE_IDLE、SCROLL_STATE_TOUCH_SCROLL、SCROLL_STATE_FLING SCROLL_STATE_IDLE是当屏幕停止滚动时SCROLL_STATE_TOUCH_SCROLL是当用户在以触屏方式滚动屏幕并且手指仍然还在屏幕上时 SCROLL_STATE_FLING是当用户由于之前划动屏幕并抬起手指,屏幕产生惯性滑动时*/ public static int SCROLL_STATE_IDLE = 0; /** * The user is scrolling using touch, and their finger is still on the screen */ public static int SCROLL_STATE_TOUCH_SCROLL = 1; /** * The user had previously been scrolling using touch and had performed a fling. The * animation is now coasting to a stop */ public static int SCROLL_STATE_FLING = 2; /** * Callback method to be invoked while the list view or grid view is being scrolled. If the * view is being scrolled, this method will be called before the next frame of the scroll is * rendered. In particular, it will be called before any calls to * {@link Adapter#getView(int, View, ViewGroup)}. * * @param view The view whose scroll state is being reported * * @param scrollState The current scroll state. One of {@link #SCROLL_STATE_IDLE}, * {@link #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}. */ public void onScrollStateChanged(AbsListView view, int scrollState); /** * Callback method to be invoked when the list or grid has been scrolled. This will be * called after the scroll has completed * @param view The view whose scroll state is being reported * @param firstVisibleItem the index of the first visible cell (ignore if * visibleItemCount == 0) * @param visibleItemCount the number of visible cells * @param totalItemCount the number of items in the list adaptor */ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount); /* * 参数view表示被滚动的listview * 参数firstVisibleItem 表示在当前屏幕显示的第一个listItem在整个listView里面的位置(下标从0开始) * 参数visibleItemCount表示在现时屏幕可以见到的ListItem(部分显示的ListItem也算)总数 * 参数 totalItemCount表示ListView的ListItem总数 */ }
0 0
- Android开发 ListView的OnScrollListener详解
- android中OnScrollListener的详解(Listview分批加载用到)
- Android中OnScrollListener的详解(Listview分批加载用到)
- Android中OnScrollListener的详解(Listview分批加载用到)
- Android中OnScrollListener的详解(Listview分批加载用到)
- Android中OnScrollListener的详解(Listview分批加载用到)
- Android中OnScrollListener的详解(Listview分批加载用到
- ListView的滚动事件onScrollListener详解
- Android中OnScrollListener的详解
- ListView OnScrollListener详解
- ListView OnScrollListener详解
- ListView OnScrollListener详解
- android listview onScrollListener方法的使用
- android ListView OnScrollListener
- ListView的onScrollListener
- ListView的OnScrollListener接口
- Android-ListView详解(SimpleAdapter,ArrayAdapter,BaseAdapter,OnItenClickListener,OnScrollListener)
- ****Android开发教程:OnScrollListener实现ListView滚屏时不加载数据
- CheckBox的API
- 我的高精度加法模板
- OC语法<3.1> OC中特有的语法:Category分类
- 数据库连接池-C3P0
- 蓝牙Profile的概念和常见种类(转)
- Android开发 ListView的OnScrollListener详解
- Poj1308 并查集
- 我的高精度乘法模板
- 加州理工学院公开课:机器学习与数据挖掘_SVM(第十四课)
- EOJ1129递推
- LeetCode OJ 之 Decode Ways (解码方式)
- android优秀开源项目
- 迪杰斯特拉算法
- 接口与抽象类