0
public class AndroidAnim extends Activity {
/** Called when the activity is first created. */
boolean b=false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ImageView imageView1 = (ImageView) findViewById(R.id.ImageView1);
final ImageView imageView2 = (ImageView) findViewById(R.id.ImageView2);
final AnimationDrawable myAnimation1;
imageView1.setBackgroundResource(R.drawable.loadinganim);
imageView2.setBackgroundResource(R.drawable.loadinganim);
myAnimation1 = (AnimationDrawable) imageView1.getBackground();
imageView2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
for(int i=0;i<20;i++){
myAnimation1.start();
imageView2.startAnimation(AnimationUtils.loadAnimation(getBaseContext(), R.anim.effect_in));
}
}
});
}} 我 使用此代碼試圖招2 ImageView的。更清楚我希望當我點擊屏幕時,一個接一個地移動ImageView(第一次移動imageView1,之後必須移動imageView2) 對不起,我的英文。如何移動的ImageView
檢查http://techdroid.kbeanie.com/2010/04/simple-drag-n-drop-on-android.html – milind