80,351
社区成员
发帖
与我相关
我的任务
分享
int[] location = new int[2];
viewPage.getLocationOnScreen(location); //动画开始控件的位置
int x = location[0];
int y = location[1];
final int[] toLocation = new int[2];
rlJ.getLocationOnScreen(toLocation);//动画结束控件的位置
int width = viewPage.getWidth();
int height = viewPage.getHeight();
ArcTranslateAnimation arcTranslateAnimation = new ArcTranslateAnimation(
0, toLocation[0] - x, 0, toLocation[1] - y);//自定义动画
arcTranslateAnimation
.setInterpolator(new LinearInterpolator());
arcTranslateAnimation.setDuration(1000);
arcTranslateAnimation.setFillAfter(true);
ImageView animationIV = new ImageView(mActivity);
FrameLayout.LayoutParams ll = new FrameLayout.LayoutParams(
width, height);
ll.gravity = Gravity.TOP;
ll.setMargins(x, y, x + width, y + height);
animationIV.setLayoutParams(ll);
String url = "";
try {
url = productImageBeans.get(viewPage
.getCurrentItem()).imageUrl;
} catch (Exception e) {
e.printStackTrace();
}
((ViewGroup) ((Activity) mActivity).getWindow()
.getDecorView()
.findViewById(android.R.id.content))
.addView(animationIV);
ImageLoader.getInstance().displayImage(url,
animationIV, null, null);
animationIV.startAnimation(arcTranslateAnimation);