用线程当中的sleep方法,比如停两秒就是Thread.sleep(2000);
public void run() {
while(!Thread.currentThread().isInterrupted()){
try{
Thread.sleep(100);
}catch(InterruptedException e){
Thread.currentThread().interrupt();
}
postInvalidate();
}
}
记住开线程哈new Thread(this).start();
线程有个wait()方法吧