【发布时间】:2015-03-02 21:31:34
【问题描述】:
我希望在 RecyclerView 的顶部显示一个加载图标,并在数据加载完成后消失
看起来像:
谁能帮帮我?
我的代码在 RecyclerView 上方显示了一个 TextView,上面写着“正在加载...”并在加载数据后消失,但 RecyclerView 仍然可见。
我的 XML:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/loaderTV"
android:text="Loading..."
android:layout_above="@+id/eventListRV"/>
<android.support.v7.widget.RecyclerView
android:scrollbars="vertical"
android:id="@+id/eventListRV"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/spinner">
</android.support.v7.widget.RecyclerView>
然后在我的代码中
client.listCreators(request, new Callback<ServiceResponse<Event>>() {
@Override
public void success(ServiceResponse<Event> eventServiceResponse, Response response) {
eventList.addAll(eventServiceResponse.data.results);
Log.i("tag", String.valueOf(eventServiceResponse.data.total));
if (eventList.size() > 60) {
adapter.notifyDataSetChanged();
loadingText.setVisibility(View.GONE);
}
}
但我希望 RecyclerView 在数据加载时不可见,我希望进度条位于 RecyclerView 的顶部,我不希望它是文本视图
【问题讨论】: