同步时显示进度条中的文件名称

Display Name of Files In Progress Bar While Syncing

我的应用程序在第一次启动时从服务器同步数据。现在我想在此同步过程中显示进度条,我还想显示从服务器同步的文件的名称。 如果有人对此有任何想法,请帮助我?

没有实现此目的的默认方法。

但是,您可以使用任何允许叠加视图的布局(例如 FrameLayoutRelativeLayout),将 TextView 置于 ProgressBar 之上。然后,您应该根据您读取的文件名(可能在循环内)更新 TextView 的值。

<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
    <ProgressBar
        android:id="@+id/download_progress
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
    >
    <TextView
        android:id="@+id/download_file_name
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_grvity="center"
    >
</RelativeLayout>

并配置颜色,使它们具有足够的对比度。