我想要在listView中动画的一部分项目。 动画在代码中描述。动画列表中的部分项目
什么是最好的方式来做到这一点,而不会重载mainThread?
@Override
public View getView(int position, View convertView, ViewGroup parent) {
StockExchangeModel stockExchangeModel = mStockExchangeModels.get(position);
ViewHolder holder;
if (convertView == null){
convertView = ((LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.item_stock_exchange, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if (stockExchangeModel.isNeedAnim()){
// blink color RED
// wait 0.2s
// return to start color
// wait 0.2s
// blink color RED
// wait 0.2s
// return to start color
}
holder.value.setText(String.format("%.2f",stockExchangeModel.getValue()));
holder.change.setText(stockExchangeModel.getChange());
holder.name.setText(stockExchangeModel.getName());
return convertView;
}
只需使用一个asynctask。 –
我不认为这是做这件事的最好方法 – Esperanz0
@MarcoBarbosa这会导致应用崩溃,你不能更新单独线程的视图。 – Linxy