【发布时间】:2019-12-20 19:35:58
【问题描述】:
我在从 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) 时没有任何反应,不会显示占位符。有人可以帮我显示占位符吗?任何帮助将不胜感激。
【问题讨论】:
-
占位符默认是启用的(见here),所以什么也没发生
-
@atarasenko 删除对
.setEnablePlaceholders(true)的调用不会改变任何内容。还有其他想法吗?
标签: android firebase google-cloud-firestore placeholder android-paging-library