我想在列表加载时在列表视图中添加一个进度条,如果加载完成后没有结果,我想使用 setEmptyView 函数添加一个 textVeiw 说明列表为空。我尝试使用此代码在列表中添加进度条,但现在很幸运:
@Override
protected void onPreExecute() {
ProgressBar progress = new ProgressBar(parent);
progress.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
((ListView) view).setEmptyView(progress);
super.onPreExecute();
}
如何务实地在列表中添加进度条,而不使用 xml 布局来填充它?谢谢