我正在为旋转图像编写代码并保存到SD卡。
使用Picasso库旋转图像并使用RotateAnimation设置动画。
关注我的代码
Picasso.Builder builder = new Picasso.Builder(this);
Picasso picasso = builder.build();
Uri uri = Uri.fromFile(new File(mImageFilePath));
RotateAnimation rotate = new RotateAnimation(0, 90,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotate.setDuration(800);
mivProfileImage.startAnimation(rotate);
picasso.load(uri).rotate(angle).into(mivProfileImage);
问题:
像whatapp app一样流畅的动画。有没有图书馆?
请帮帮我。
答案 0 :(得分:1)
这是一个好的图书馆:https://github.com/daimajia/AndroidViewAnimations 它激活了几乎所有观点。
您必须应用您的逻辑旋转然后保存到SD卡。这是一个例子。
Yoyo.with(Techniques.Rotate).duration(800).playOn(YourImageView);
// this is class for the custom library that I mentioned.
// This will rotate the imageview in 800 milliseconds. So you want to save the image
// to sd card after 800 milli seconds. For this, we need to create a Handler.
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// save image to sd card after 800 milliseconds.
}
}, 800);