我正在尝试设置不同图像的自定义动画幻灯片。我设法使用自定义视图为单个图像设置动画。现在我想为我的数组列表中的所有图像设置幻灯片放映。这样图像将一个接一个地显示。现在我有一个自定义视图,是否需要为每个图像创建更多视图?有任何想法吗?
自定义视图:
public class AnimationPhotoViewA extends ImageView
{
@Overridepublic void setImageBitmap(Bitmap bm)
{super.setImageBitmap(bm);image= bm;}
活动:
public class PhotoSyncActivity extends Activity implements AnimationListener {
@Override
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);
setContentView(R.layout.photo_sync_screen);
ArrayList<String> photoPaths = new ArrayList<String>();
photoPaths = getAllPhotos(Environment.getExternalStorageDirectory(),
photoPaths);
images = new Bitmap[photoPaths.size()];
Log.v(ACCESSIBILITY_SERVICE, "photo array!" + photoPaths);
apa1 = (AnimationPhotoViewA) findViewById(R.id.animation_viewA);
//START ANIMATION
animationmove = PhotoAnimationProcess.moveOne(this,apa1,animationmove);
File imgFile = new File(photoPaths.get(0));
if (imgFile.exists())
{
images[0] = decodeFile(imgFile);
}
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
// SET IMAGE IN THE VIEW
apa1.setImageBitmap(resizedimage);
}
private void addPicture() {
// TODO Auto-generated method stub
}
public void onAnimationStart(Animation animation)
{
// TODO Auto-generated method stub
}
public void onAnimationEnd(Animation animation)
{
// TODO Auto-generated method stub
switch (animationmove)
{
case move1:
animationmove = PhotoAnimationProcess.moveOne(this, apa1, animationmove);
break;
case move2:
addPicture();
animationmove = PhotoAnimationProcess.moveTwo(this,apa1,animationmove);
break;
case move3:
animationmove = PhotoAnimationProcess.moveThree(this,apa1,animationmove);
break;
case move4:
animationmove = PhotoAnimationProcess.moveFour(this,apa1,animationmove);;
break;
case move5:
animationmove = PhotoAnimationProcess.moveFive(this,apa1,animationmove);
break;
default:
break;
}
Log.v(ALARM_SERVICE, "Animation Type" + animation.toString());
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
}