我有自定义对象的arraylist。每个自定义对象对应于我的应用程序中滚动视图内的模态。如果有5"考勤卡"在我的数组列表中,将有5个垂直堆叠的模态。
我想要的最终行为是,如果我有一张5张卡的垂直堆叠,我想设置第一张卡的动画,完成时,启动第二张,完成后,做第三张等等。
这是我的方法:
public void inflatetimeCardContainer(){
timecardContainer.removeAllViews();
int tclistIndex = 0;
for(TimeCard tc : timeCardList){
timeCardFragment = (RelativeLayout)LayoutInflater.from(this).inflate(R.layout.timecard_fragment, timecardContainer, false);
textViewTitle = (TextView)timeCardFragment.findViewById(R.id.textViewTitle);
textViewHours = (TextView)timeCardFragment.findViewById(R.id.textViewHours);
textViewPay = (TextView)timeCardFragment.findViewById(R.id.textViewPay);
textViewNotes = (TextView)timeCardFragment.findViewById(R.id.textViewNotes);
buttonDelete = (Button)timeCardFragment.findViewById(R.id.buttonDelete);
buttonDelete.setOnClickListener(handleButtonDelete);
buttonDelete.setId(tclistIndex++);
textViewTitle.setText(tc.getTitle());
textViewHours.setText("Hours: " + String.valueOf(tc.getHours()));
textViewPay.setText("Pay after taxes: " + String.valueOf((tc.getHours()*tc.getPayRate())*0.77));
textViewNotes.setText(tc.getNotes());
timeCardFragment.setAlpha(0);
timecardContainer.addView(timeCardFragment);
timeCardFragment.animate().alpha(1.0f);
// SOME KIND OF PAUSE HERE UNTIL ANIMATION IS DONE
// One the animation is done, continue in my for loop
}
}
答案 0 :(得分:-1)