小编fre*_*nes的帖子

在RecylerView上设置进度条,并在加载数据后删除

我希望有一个加载图标显示在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>
Run Code Online (Sandbox Code Playgroud)

然后在我的代码中

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);
                }
            }
Run Code Online (Sandbox Code Playgroud)

但我希望RecyclerView在数据加载时不可见,我希望在RecyclerView所在的进度条上面,我不希望它成为textview

android android-layout

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

android-layout ×1