-
android 解锁例子源码
package com.codeshogun.android.swipesample;import android.app.Activity;import android.os.Bundle;import android.view.GestureDetector;import android.view.MotionEvent;import android.view.View;import android.view.GestureDetector.SimpleOnGestureListener;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.widget.ViewFlipper;public class Main extends Activity { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static final int SWIPE_THRESHOLD_VELOCITY = 200; private GestureDetector gestureDetector; View.OnTouchListener gestureListener; private Animation slideLeftIn; private Animation slideLeftOut; private Animation slideRightIn; private Animation slideRightOut; private ViewFlipper viewFlipper; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); viewFlipper = (ViewFlipper)findViewById(R.id.flipper); slideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_left_in); slideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_left_out); slideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_right_in); slideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_right_out); gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { return true; } return false; } }; } class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) return false; // right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { viewFlipper.setInAnimation(slideLeftIn); viewFlipper.setOutAnimation(slideLeftOut); viewFlipper.showNext(); } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { viewFlipper.setInAnimation(slideRightIn); viewFlipper.setOutAnimation(slideRightOut); viewFlipper.showPrevious(); } } catch (Exception e) { // nothing } return false; } } @Override public boolean onTouchEvent(MotionEvent event) { if (gestureDetector.onTouchEvent(event)) return true; else return false; }}
- 2014-04-16下载
- 积分:1
-
SpnOverride
private HashMap Source Code for Andriod.
- 2013-12-13 14:51:23下载
- 积分:1
-
Tourism_Memory1
个人开发的 一个基于android平台的LBS 旅游记忆项目 是社区应用 有地图位置的服务 记忆自己的旅游足迹 分享给好友...使用了闪屏,等各种绚丽的界面,数据库使用contentProvider来提供通过uri和界面交互。有注释,适合新手学习。(Personal development of a tourism based on the android platform of LBS applications have memory map of the project is the location of community services to share the memory footprint of their travel to friends ...)
- 2021-04-25 22:48:46下载
- 积分:1
-
android 项目 记录日志例子
android 项目 记录日志例子
- 2014-09-17下载
- 积分:1
-
wifi语音对讲
实现局域网内语音对讲发送文字
- 2013-06-29下载
- 积分:1
-
MyPiano
一个实现钢琴功能的简单小安卓程序,里面可以学到播放声音,以及按键的动起来(The Andrews program a simple piano function, which you can learn to play a sound, as well as key move)
- 2012-08-25 10:18:02下载
- 积分:1
-
安卓远程监控 客户端完整源码
安卓远程监控 客户端完整源码
- 2014-12-08下载
- 积分:1
-
基于单片机的无刷直流电机控制
单片机实现无刷直流电机的调速控制
- 2021-05-07下载
- 积分:1
-
umeng统计代码 实例源码源码下载
各种android app操作的统计,支持fragment
- 2015-04-11下载
- 积分:1
-
AndroidCircularSeekBar
安卓圆形的SeekBar, 带进度指示圆点(Andrews round SeekBar)
- 2013-10-10 17:27:22下载
- 积分:1