gif动画效果 移动动画效果

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >

    <item
        android:drawable="@drawable/plix_bottom_logo"
        android:duration="200"/>
    <item
        android:drawable="@drawable/plix_bottom_logo2"
        android:duration="200"/>
    <item
        android:drawable="@drawable/plix_bottom_logo1"
        android:duration="200"/>
    <item
        android:drawable="@drawable/plix_bottom_logo"
        android:duration="200"/>
    <item
        android:drawable="@drawable/plix_bottom_logo"
        android:duration="1000"/>

</animation-list>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

package gt.gt;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.ListView;

public class AnimationActivity extends Activity {
 ImageView iv;
 AnimationDrawable ad;

 ListView lv;
 private Animation mTranslateAnimation = null;
 MyAdapter myAdapter;

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

  lv = (ListView) findViewById(R.id.listView1);

  iv = (ImageView) findViewById(R.id.imageView1);

 

  iv.setBackgroundResource(R.anim.photos);//上面的xml文件

 

 

  ad = (AnimationDrawable) iv.getBackground();

  myAdapter = new MyAdapter(this, R.layout.row);

  lv.setAdapter(myAdapter);

  iv.setOnClickListener(new View.OnClickListener() {

   @Override
   public void onClick(View v) {// v代表点击的View
   // Intent intent = new Intent(AnimationActivity.this,
   // ListActivity.class);
   // startActivity(intent);

    mTranslateAnimation = new TranslateAnimation(0, 0, 0, -500);// 移动
    mTranslateAnimation.setDuration(2000);
   // mTranslateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
   // mTranslateAnimation.setFillAfter(true);
   // mTranslateAnimation.setFillEnabled(true);
   // mTranslateAnimation.setZAdjustment(Animation.ZORDER_TOP);
    
    
    lv.startAnimation(mTranslateAnimation);
               
    
    if (ad.isRunning())
     ad.stop();
    else
     ad.start();

   }
  });
  // this.setContentView(lv);
 }

 @Override
 public boolean onTouchEvent(MotionEvent event) {
  switch (event.getAction()) {
  case MotionEvent.ACTION_DOWN:
   // ad.start();
   break;

  default:
   break;
  }
  return super.onTouchEvent(event);
 }
}

你可能感兴趣的:(android,xml,ListView,Class,animation,encoding)