美文网首页
14.4 Vibrator

14.4 Vibrator

作者: jadefly | 来源:发表于2018-09-13 10:48 被阅读0次

简介

振动器,Android给我们提供的用于机身震动的一个服务。

权限: <uses-permission android:name="android.permission.VIBRATE"/>


常用方法

boolean hasVibrator():判断硬件是否有振动器

void cancel():关闭或者停止振动器

void vibrate(long milliseconds):控制手机振动为milliseconds毫秒

void vibrate(long[] pattern,int repeat):指定手机以pattern指定的模式振动

                    pattern:[200,400,600,800],等待200毫秒开启,震动400毫秒,停止600毫秒,震动800毫秒

                    repeat:重复次数,-1只振动一次,0一直振动 


简单使用

简单使用

相关文章

网友评论

      本文标题:14.4 Vibrator

      本文链接:https://www.haomeiwen.com/subject/xttwgftx.html