Moj*_*bye 15 java android listview
我试图ProgressBar用每个ListView项目的简单动画显示,但是当我滚动时,ProgressBar动画停止.滚动结束后,动画再次开始.见下图.

TAH*_*62K 13
你必须在getView()中使用动画并为convertView示例设置动画:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
StructureArticles item = getItem(position);
if (convertView == null) {
convertView = G.inflater.inflate(R.layout.adapter_articles, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.fill(this, item, position);
Animation animationListView = AnimationUtils.loadAnimation(context, R.anim.scale_fade_in);
convertView.startAnimation(animationListView);
return convertView;
}
Run Code Online (Sandbox Code Playgroud)
Moj*_*bye 10
我在我的适配器中使用了这个语法并且问题解决了!
public class AdapterDownload extends ArrayAdapter<StructDownload> {
public AdapterDownload(ArrayList<StructDownload> array) {
super(G.context, R.layout.item_layout, array);
}
private static class ViewHolder {
public ViewHolder(View view)
{
}
public void fill(final ArrayAdapter<StructDownload> adapter, final StructDownload item, final int position)
{
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
}
Run Code Online (Sandbox Code Playgroud)
}
谢谢.
| 归档时间: |
|
| 查看次数: |
1520 次 |
| 最近记录: |