动画
1.创建四种动画star
ScaleAnimation scaleAnimation = new ScaleAnimation(0, 2, 0, 2);
TranslateAnimation translateAnimation = new TranslateAnimation(0, 100, 0, 100);
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
RotateAnimation rotateAnimation = new RotateAnimation(0, 360);
2.创建动画集合
3.设置动画时间保存动画
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(5000);//设置时间
animationSet.addAnimation(scaleAnimation);//运行缩放
animationSet.addAnimation(translateAnimation);//位移
animationSet.addAnimation(alphaAnimation);//渐变
animationSet.addAnimation(rotateAnimation);//旋转
4.图片开启或者存入动画
ivImg.setAnimation(animationSet);//设置动画集合
Rxjava倒计时:
1.自定义变量long类型长度随设置时间来说
2.设置闪屏
Observable.interval(1000, TimeUnit.MILLISECONDS)//一秒
3.再次声明新的long变量等于定义时间变量count-along(参数)
4.判断如果新变量大于等于0数tvtext修改(“倒计时:”+newcount)
5 private Disposable disposable;等于d 为了使方式多次进入本页面
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
disposable = d;
}
@Override
public void onNext(Long aLong) {
long newCount = count - aLong;
if (newCount >= 0) {
tvDao.setText("倒计时:" + newCount);
} else {
disposable.dispose();
startActivity(new Intent(MainActivity.this, CollPrjiectActivity.class));
finish();
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});