これは上記の答えのコードです。私の場合はうまくいきました:
アダプターを設定してから削除する前に、listView に footerView (ページネーション付きの listView の loadingView です) を設定する必要がありました。まず、OnCreate メソッドでレイアウト ファイルから loadingView を初期化しました。
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
loadingView = layoutInflater.inflate(R.layout.loading_view, null);
次に、同じ方法でこの回避策を使用しました。
this.setIsLoading(true);
listView.setAdapter(adapter);
this.setIsLoading(false);
どこ
private void setIsLoading(boolean isLoading)
{
this.isLoading = isLoading;
if (isLoading) {
listView.addFooterView(loadingView);
}
else {
listView.removeFooterView(loadingView);
}
}