0
所以我面臨這個問題: 我需要顯示異步加載的項目列表。 當他們被加載時,我想逐一顯示它們。我嘗試使用LayoutAnimationController。但它似乎有問題,我不明白它是什麼。LayoutAnimationController爲了顯示列表中的一個一個的元素
這裏是我的代碼:
this.adapter = new ReactionTypeAdapter(getActivity(), R.layout.row_reaction_type, reactionTypeArrayList); // reactionTypeArrayList at this stage.
reactionTypeListView.setAdapter(adapter);
Animation animation = new AlphaAnimation(1.0f, 0.0f); // these are de debug parameters in order to see if the animation play
animation.setDuration(500);
final LayoutAnimationController controller = new LayoutAnimationController(animation, 0.5f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
reactionTypeListView.setLayoutAnimation(controller);
reactionTypeRepository.retrieveAll(new IRepositoryCallback<ArrayList<ReactionType>>() {
@Override
public void OnSuccess(ArrayList<ReactionType> entity) {
adapter.addAll(entity);
adapter.notifyDataSetChanged();
}
@Override
public void OnError() {
}
});
我試圖設置的onSuccess回調裏面的適配器,但結果是一樣的。
奇怪的是,當使用Android Studio的即時運行時,我得到了預期的結果。但刷新整個應用程序時,我看不到動畫
這不填我的要求。我想了解這段代碼有什麼問題。無論如何,謝謝你試圖幫助我;) – Astyan