Gallery去除惯性、半屏翻页
来源:互联网 发布:北京php招聘 编辑:程序博客网 时间:2024/06/10 08:43
问题描述:
有时候,我们不需要Gallery的惯性,如何去掉Gallery的惯性?
解决方法:
通过继承Gallery,并重写一些方法,自定义Gallery特性。
import android.content.Context;import android.util.AttributeSet;import android.view.KeyEvent;import android.view.MotionEvent;import android.widget.Gallery;public class DetailGallery extends Gallery {public DetailGallery(Context context, AttributeSet attrSet) {super(context, attrSet);}private boolean isScrollingLeft(MotionEvent e1, MotionEvent e2) {return e2.getX() > e1.getX();}@Overridepublic boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {int kEvent;if (isScrollingLeft(e1, e2)) {// Check if scrolling leftkEvent = KeyEvent.KEYCODE_DPAD_LEFT;} else {// Otherwise scrolling rightkEvent = KeyEvent.KEYCODE_DPAD_RIGHT;}onKeyDown(kEvent, null);return true;}}
注意,在xml文件中,使用自定义的DetailGallery代替默认的Gallery。
- Gallery去除惯性、半屏翻页
- Gallery滑动惯性
- android gallery滑动惯性问题
- android gallery滑动惯性问题
- Android gallery滑动惯性问题
- android Gallery 实现短距离滚动 取消惯性
- android Gallery去掉滑动惯性效果
- Gallery Fling翻页以及自动翻页
- Activity 去除翻页效果
- Phoca Gallery Images 去除 logo
- 为Android Gallery添加手势翻页
- Hello Views之Gallery(yaozq翻页,仅供参考)
- Android Gallery实现滑动翻页效果
- 惯性
- 惯性
- Android 去除Gallery的边缘颜色
- Android 去除Gallery的边缘颜色
- Gallery中,取消惯性滑动,滑动一次只切换一个视图
- 使用VI同时编辑多个文件
- 快速开发一个PHP扩展
- 第5周实验报告1-4
- 内核源码中找不到fcntl()函数
- phpmailer 类发送邮件乱码解决方法
- Gallery去除惯性、半屏翻页
- mysql在lunix安装
- asp.net 从客户端中检测到有潜在危险的 Request.Form 值
- 第五周实验报告 1-1
- zend studio 9 字体,颜色,快捷键等相关设置
- 新的搜索引擎
- iphone开发资源汇总
- KILL僵尸进程
- Nao机器人运行B-human代码之基础篇