gpt4 book ai didi

下载期间android ProgressBar更新

转载 作者:行者123 更新时间:2023-11-30 02:35:33 24 4
gpt4 key购买 nike

在我的文件下载应用程序中有一个 ListView,每一行都包含属性文件和一个用于下载它的状态的 ProgressBar,我使用 View Holder 模式,但进度条不更新

@Override
protected void onProgressUpdate(Long... values) {
ProgressBar bar1;
TextView status1;
DownloadStructure.setProgress(values[0].intValue());
bar1 = DownloadStructure.getProgressBarRefrence();
if (bar1 != null) {
bar1.setVisibility(View.VISIBLE);
bar1.setMax(values[2].intValue());
bar1.setProgress(DownloadStructure.getProgress());
bar1.Invalidate();
}
status1 = DownloadStructure.getProgressTextviewRefrence();
if (status1 != null) {
status1.setVisibility(View.VISIBLE);
status1.setText(DownloadStructure.getDownloadStatus());
status1.postInvalidate();
}
}

最佳答案

尝试调用 notifyDataSetChanged :

        protected void onPostExecute(Boolean result) {
...
myListView.notifyDataSetChanged(); //or simply notifyDataSetChanged if your Async inside adapter
}

关于下载期间android ProgressBar更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26624151/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com