android Vibrator震动效果

Vibrator为震动对象

Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
//震动频率
long[] pattern = { 1000, 1800, 1000, 1800 }; // OFF/ON/OFF/ON...
vibrator.vibrate(pattern, 2);// -1不重复,非-1为从pattern的指定下标开始重复


//取消震动
vibrator.cancel();




需要添加权限:
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
posted @ 2012-09-18 20:17  可可ing  阅读(236)  评论(0编辑  收藏  举报