android振动器
来源:互联网 发布:竞价排名软件 编辑:程序博客网 时间:2024/05/01 11:00
总感觉手机上的振动器没有多大用处(当然静音模式下的振铃很有用),但还是顺带着说一下吧,只有两行代码:
1、获取振动服务的实例
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
2、设置振动时长,单位当然也是ms
vibrator.vibrate(1000);
如果你觉得这样过去单调的话,可以设个节奏:
vibrator.vibrate(new long[]{10, 100, 20, 200}, -1);
两个参数,习惯告诉我第一个是节奏,第二个是重复次数,可事实并没有这么简单,我翻译不好,大家还是看原文吧:
public void vibrate (long[] pattern, int repeat)
pattern: an array of longs of times to turn the vibrator on or off.
repeat: the index into pattern at which to repeat, or -1 if you don't want to repeat.
google喜欢弄些技巧,我却觉得这里有点弄巧成拙了。
- android振动器
- Android 振动器
- android振动器
- Vibrator--android 振动器
- Android 的振动器
- android的振动器Vibrator
- android 振动器系统
- Android 的振动器
- android振动器(Vibrator)
- android[Api]Vibrator_振动器
- Android 振动器系统架构
- Android振动器的使用
- Android中的振动器---Vibrator
- Android Vibrator 振动器
- 初学Android,手机振动器(六十七)
- Android振动器(Vibrator)系统详解
- Android振动器(Vibrator)系统详解
- android手动调用振动器(Vibrator)
- C++ 0x(C++ 09)新标准全部革新提案文档列表
- android中正确导入第三方jar包
- ArcGIS desktop 9.2---完整破解版下载及安装
- android闹钟
- 笑笑你
- android振动器
- android internet参数传递
- android屏幕显示设置
- mysql数据库索引查询一个优化大数据量的实例的分享
- visual studio 2005教程
- android相机拍照
- android多媒体录制
- javax.xml.transform.TransformerFactoryConfigurationError
- android视频播放