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>