1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| public static void browerImage(Activity activity, final ImageView originImageV, final ImageView scaleImageV){
int x = originImageV.getLeft();
int y = originImageV.getTop();
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation = new TranslateAnimation(
Animation.ABSOLUTE, x,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, y,
Animation.ABSOLUTE, scaleImageV.getY() - getStatusBarHeight(activity));
translateAnimation.setDuration(1500);
animationSet.addAnimation(translateAnimation);
ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, (float)width/originImageV.getWidth(), 1.0f,
(float)width/originImageV.getWidth(),
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0);
scaleAnimation.setDuration(1500);
animationSet.addAnimation(scaleAnimation);
animationSet.setFillEnabled(true);
animationSet.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
originImageV.setVisibility(View.INVISIBLE);
scaleImageV.setVisibility(View.VISIBLE);
originImageV.clearAnimation();
}
});
originImageV.startAnimation(animationSet);
}
|