0
我有一個ViewFlipper與許多圖像。我添加圖像ViewFlipper
像這樣:當前視圖名稱來自ViewFlipper
bitmap = BitmapFactory.decodeFile(files[i].getPath());
img = new ImageView(this);
img.setImageBitmap(bitmap);
img.setScaleType(ImageView.ScaleType.FIT_XY);
vf.addView(img, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
img = null;
進入for循環。當動畫開始我想知道像(形象的名字)將顯示,因爲一些圖片,我必須stopflipping的ViewFlipper.
我嘗試這樣做:
animFlipInNext.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
System.out.println("AnimStart- LeftIn" + " Will be displayed "
+ vf.getDisplayedChild());
final File[] imageName = images.listFiles(); //images that I want for viewflipper to stop.
for (int i = 0; i < images.length(); i++) {
bitmap = BitmapFactory.decodeFile(imageName[i].getPath());
Drawable background = new BitmapDrawable(bitmap);
if (vf.getCurrentView().getBackground().equals(background)) {
System.out.println("begin "
+ files[i].getName());
} else
System.out.println("NUNUNU");
}
}
但沒有任何反應。我沒有收到任何消息。我的錯誤在哪裏?或者,如何做到這一點?