2015-10-05 112 views
2

我需要進行imageview的轉換,這是我自己很難做到的。在搜索預建庫幾個小時後,我只發現了一些活動轉換&簡單的淡入/淡出轉換。有沒有android的任何圖像視圖過渡庫?

我發現什麼是材料與動漫活動和viewflipper:

https://github.com/lgvalle/Material-Animations https://androidmyway.wordpress.com/2012/10/30/slide-transition-in-viewflipper/

我需要的是豎條,溶解,爆炸,在Windows Movie Maker或jQuery的動畫像其他先進的過渡。

Car Dissolve transition

Car Vertical Bar transition

如果對於這種東西任何預建的Android庫,請讓我知道。謝謝 !

+0

https://android-arsenal.com/tag/6 –

+0

@Karan Mer謝謝你的聯繫,但我沒有找到我需要的東西 – dilz

+0

你找到了嗎? –

回答

1

你應該嘗試用android動畫類編寫自己的自定義動畫。這是一個庫鏈接,您可以根據需要進行學習和修改。它包含了動畫像爆炸,摺疊等

https://github.com/2359media/EasyAndroidAnimations

對於你的問題,第一個動畫是有點困難。它需要掩蔽完美的動畫,如上所示。如果你想要一些簡單的提示,你可以嘗試使用下面的兩個黑色圖像。確保用黑色部分覆蓋整個屏幕。然後將一個圖像移到下方,另一個移動到右邊以創建效果。

horizontal bar

vertical bar

秒的動畫是很簡單的,你可以嘗試類似如下的提示:

<framelayout> 
    <imageview src="@drawable/car.jpg"> 
    <linearlayout 
     weightsum="9" 
     orientation="horizontal"><!--set it's width height to cover car image--> 
     <imageview @+id="imgview1" 
      weight="1" src="@drawable/blackbar.jpg"> 
     <imageview @+id="imgview2" 
      weight="1" src="@drawable/blackbar.jpg"> 
     . 
     . 
     <imageview @+id="imgview9" 
      weight="1" src="drawable/blackbar.jpg"> 
    </linearlayout> 
</framelayout> 

在Java代碼中,嘗試下面的動畫爲黑條。

new Timer().schedule(new TimerTask() { 
     @Override 
     public void run() { 
      runOnUiThread(new Runnable() { 
       @Override 
       public void run() { 
        ScaleAnimation anim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF,0.0f, Animation.RELATIVE_TO_SELF, 0.5f); 
        anim.setFillAfter(true); 
        anim.setDuration(400); 
        imgBlackBar1.startAnimation(anim); 

       } 
      }); 
     } 
    }, 150); 

現在,根據需要設置bar2 300,bar3 450等的延遲。

+0

爲第二動畫你的解決方案真的對我非常感謝, – dilz

1
  1. 從這裏下載一組動畫:

    ------>https://drive.google.com/folderview?id=0B_tCPatPrHgyWmNtWjM2X1ZiV1k&ddrp=1#

  2. 在你的Android項目,如果在Eclipse的工作,打開A/RES,文件夾,然後去到菜單: 文件>新建>文件夾>爲文件夾命名:「anim」。

  3. 將所有文件複製到此文件夾。只需從Windows資源管理器中拖動它們現在我們完成了準備工作並準備好使用下載的軟件。

  4. 活動主屏幕包含一個圖像。當點擊發生時,圖像開始動畫,請參閱下面的代碼示例:

/* xml文件 *

*文件結束 */

import android.app.Activity; 
import android.os.Bundle; 
import android.view.View; 
import android.view.animation.Animation; 
import android.view.animation.AnimationUtils; 
import android.widget.ImageView; 

public class MainActivity extends Activity { 
ImageView image; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    image = (ImageView) findViewById(R.id.imageView); 

    image.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View arg0) { 

     image.startAnimation(selectanimation((int)(Math.random()*6))); //randomly select animation 0-5 
     } 

    }); 
} 
    private Animation selectanimation(int index) { 
    switch(index){ 
    /* 
    * create animations, and return them to caller. 
    */ 
    case 0: return new AnimationUtils().loadAnimation(this, R.anim.shake); 
    case 1: return new AnimationUtils().loadAnimation(this, R.anim.fade); 
    case 2: return new AnimationUtils().loadAnimation(this, R.anim.slide_left); 
    case 3: return new AnimationUtils().loadAnimation(this, R.anim.wave_scale); 
    case 4: return new AnimationUtils().loadAnimation(this, R.anim.hold); 
    case 5: return new AnimationUtils().loadAnimation(this, R.anim.zoom_enter); 
    } 
    return null; 
    } 
} 

下載完整source code這裏!

+0

感謝您的答案我經歷了所有這些動畫,但我找不到我真正想要的東西 – dilz

+0

@AndroidEnthusiastic,** dilz **也給了他想要的樣品圖像,他尋找像,http://javagraphics.blogspot.in/2007/04/slideshows-transitions-swf.html –

+0

@Mayur是啊我得到了你的積分thanq – AndroidEnthusiastic