java - 从 Firestore 获取数据时 Android 加载图标

标签 java android firebase google-cloud-firestore

我正在从 Firebase Firestore 获取数据来填充 ListView,并且我想在获取数据时显示加载动画。

最佳答案

布局代码

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout android:id="@+id/loading"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminate="true" />
    </RelativeLayout>
    <ListView android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        xmlns:android="http://schemas.android.com/apk/res/android" />
</FrameLayout>

java代码

private void finishLoadList(){
    RelativeLayout loadingLayout = (RelativeLayout) findViewById(R.id.loading);
    ListView listView = (ListView) findViewById(R.id.list_view);

    loadingLayout.setVisibility(View.GONE);
    listView.setVisibility(View.VISIBLE);
}

关于java - 从 Firestore 获取数据时 Android 加载图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47523532/

相关文章:

java - 如何在 Firestore 中使用 POJO 更新所有文档中的一个字段?

javascript - 遍历 Javascript 对象时遇到问题

java条件运算符和不同类型

android - 拍照后相机一直处于拍照模式

javascript - 云 Firestore : Retrieve dynamic field keys with Javascript

java - Android查看动态大小

ios - 确保在 Info.plist 新 GoogleSignIn IOS 版本中设置 GIDClientID

java - 十六进制编辑 Java 字节码抛出 ClassFormatError

java - 如何将 Eclipse GAE 项目迁移到 Maven,使其不会绑定(bind)到 Eclipse?

java - Ant 构建脚本是否有类似于 JSTL 库的东西