package com.example.rehabilitation;
import java.util.ArrayList;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.ProgressBar;
public class Game extends ActionBarActivity {
ArrayList<Ball> ballData = new ArrayList<Ball>();
//
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.game);
ImageView img = (ImageView)findViewById(R.id.imageView1);
img.setImageResource(R.drawable.red);
img.invalidate();
Animation ani = new TranslateAnimation(0, 0, -500, 1700);
ani.setDuration(5000);
img.setAnimation(ani);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.game, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
위의 소스는 이미지뷰에 애니메이션을주어 위에서 아래로 떨어지게 한 간단한 소스입니다.
제가 알고싶은건 이미지뷰를 동적으로 여러개 생성해서 산성비 게임처럼 랜덤으로 떨어지게
하고싶습니다. 그런데 하나는 잘되지만... 두 개 이상부터는 어떻게 해야될지 감이 안와서
질문을 올려봅니다.