0
我想啓動包含在自定義佈局內的動畫。該佈局用於列表視圖的每一行。如果移動到這個自定義佈局之外,動畫工作正常,所以問題似乎不在於images/xml文件。如何啓動包含自定義佈局的動畫
我相信問題在於我如何調用動畫。例如標準代碼,開始動畫作品(所以不使用自定義佈局):
ImageView mImageViewEmptying = (ImageView) findViewById(R.id.tetherPulseAnimationTest);
((AnimationDrawable) mImageViewEmptying.getBackground()).start();
但現在我,如果我要開始自定義佈局內包含我那麼動畫(以下是潛在的錯! )膨脹的自定義佈局到一個視圖,然後做和以前一樣:
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.custom_listview_activetethers, null);
ImageView mImageViewFilling = (ImageView) dialogView.findViewById(R.id.tetherPulseAnimation);
((AnimationDrawable) mImageViewFilling.getBackground()).start();
現在,這肯定是錯誤的,因爲它實際上並沒有做任何事情。我可以在屏幕上看到動畫的第一幀,但上面的代碼似乎並沒有啓動它。任何想法,我錯了?
make ImageView final .. –
這是一般的建議還是解決方案?無論哪種方式,它不會使動畫動畫 – Calco
如果您使用ImageView作爲final ..然後每個圖像動畫相同 –