我试图在从 Firestore 获取数据时显示占位符。这是我尝试过的:
class BarsViewModel extends AndroidViewModel {
private PagedList.Config config;
private BarSourceFactory factory;
private LiveData<PagedList<Bar>> liveData;
BarsViewModel(Application application) {
super(application);
config = new PagedList.Config.Builder()
.setEnablePlaceholders(true) //Nothing happens
.setPageSize("15")
.build();
factory = new BarSourceFactory();
liveData = new LivePagedListBuilder<>(factory, config).build();
}
LiveData<PagedList<Bar>> getBarLiveData() {
return liveData;
}
}
当我没有添加.setEnablePlaceholders(true)
任何内容时,不会显示占位符。有人可以帮我显示占位符吗?任何帮助将不胜感激。