Android Gallery获取滑动停止的位置
2012-06-22 10:51
399 查看
在网上看到很多人想得到Gallery滑动停止的位置,大部分是通过起线程的方式来获取,嘿嘿,看了一下源码查了API,
发现一个方法:
Whether or not to callback on any
大概意思是,设为false,
发现一个方法:
public void setCallbackDuringFling (boolean shouldCallback)
Since: API Level 1Whether or not to callback on any
getOnItemSelectedListener()while the items are being flinged. If false, only the final selected item will cause the callback. If true, all items between the first and the final will cause callbacks.
大概意思是,设为false,
getOnItemSelectedListener()中才返回gallery的停止位置position,滑动过程中不触发getOnItemSelectedListener()事件。
在getOnItemSelectedListener() 中 public void onItemSelected(final AdapterView<?> parent, final View view, final int position, long id) { System.out.println("itme = " + id); }
当滑动停止后才返回Item,打印停止位置
相关文章推荐
- Android Gallery获取滑动停止的位置
- 【Android】Gallery重写OnItemSelectedListener时滑动不流畅的解决办法——获取停止时的位置
- 【Android笔记】Gallery如何获取停止时的位置
- Android Gallery 滑动停止监听方案
- Android -- 加载大图片到内存,从gallery获取图片,获取图片exif信息
- android:使用gallery和imageSwitch制作可左右循环滑动的图片浏览器
- 简单实现 Android listview 滑动过程中不加载图片,停止时加载图片
- Android 开发笔记: 获取RecyclerView 滑动距离
- Android 如何从相册(gallery)获取一张图片?
- Android 获取view在屏幕中的位置
- Android通过原生APi获取所在位置的经纬度
- Android打开GPS导航并获取位置信息返回null解决方案
- Android Google Map学习一(获取最近一次的位置)
- ANDROID图片浏览(带水平滑动的GridView和类似gallery的ViewPage)
- Android获取通讯录联系人,右侧字母滑动索引
- android 获取view在屏幕中的位置
- 获取android系统下手指触摸位置
- android应用程序中获取view的位置
- Android保存和恢复ListView的滑动后位置