簡體   English   中英

旋轉圖像並像Android中的whatsapp應用一樣保存到sdcard

[英]Rotate Image and save to sdcard like whatsapp app in android

我正在編寫用於旋轉圖像並保存到sdcard的代碼。

使用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應用。 有圖書館嗎?

請幫我。

這是一個很好的庫: https : //github.com/daimajia/AndroidViewAnimations它可以動畫幾乎所有視圖。

您將必須應用on邏輯進行旋轉,然后保存到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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM