android 是否有图像视图转换库?

are there any Image View transition library for android?

我需要进行 imageview 的转换,我自己很难做到。在搜索预建库几个小时后,我只找到了一些 activity 过渡和简单的淡入淡出 in/out 过渡。

我找到的是 material 带有活动和 viewflipper 的动画:

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

我需要的是垂直条、溶解、分解和其他像 windows 电影制作器或 jquery 动画中的高级过渡。

如果有任何针对此类内容的预建 android 库,请告诉我。谢谢!

  1. 从这里下载一组动画:

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

  2. 在您的 android 项目中,如果在 Eclipse 中工作,请打开 /res 文件夹,然后转到菜单: 文件>新建>文件夹> 给文件夹命名:"anim".

  3. 将所有文件复制到此文件夹。只需将它们从 windows 资源管理器中拖出即可。现在我们完成了准备工作,可以使用下载的了。

  4. Activity 主屏幕包含一张图片。当点击发生时,图像开始动画,参见下面的代码示例:

/*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

您应该尝试使用 android 动画 class 编写自己的自定义动画。这里有一个库link,您可以根据需要学习和修改。它包含爆炸、折叠等动画

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

对于你的问题,第一个动画有点困难。如上所示,它将需要遮罩以获得完美的动画。如果你想要一些简单的提示,你可以尝试使用如下两个黑色图像。确保用黑色部分覆盖整个屏幕。然后将一张图片从下方移动到另一张向右移动以创建效果。

第二个动画很简单,你可以试试下面的提示:

<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 等的延迟。