android 自定义Gallery
16lz
2022-05-24
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;
达到一次滑动一张图片的效果
更多相关文章
- ViewPager
- Android嵌套滑动机制源码分析
- [转]Android(安卓)开源项目分类汇总
- android 界面 滑入 效果
- Android(安卓)动画1--View控件的显示和隐藏效果
- DataBinding(双向绑定)
- 一个不错的启动菜单显示屏动画效果
- Android(安卓)初识AppBarLayout 和 CoordinatorLayout
- android手势翻页效果