【问题标题】:use progressbar to indicate in the course of downloading image在下载图像的过程中使用进度条指示
【发布时间】:2013-05-06 19:30:12
【问题描述】:

以下是我的布局:

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ProgressBar
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" /> 

    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>           
</FrameLayout>

我正在尝试根据 url 链接下载一张图片,然后在ImageView 上显示该图片。在图像准备好之前,ProgressBar 会显示在ImageView 上。到目前为止,我的代码可以下载图像并将其显示在ImageView 上。由于下载需要时间,因此在图像显示之前存在明显的延迟。谁能给我一些建议?我是 android 新手,这不是作业。

【问题讨论】:

    标签: android progress-bar android-progressbar


    【解决方案1】:

    你需要使用AsyncTask...这里有一个很好的教程:

    http://www.androidhive.info/2012/04/android-downloading-file-by-showing-progress-bar/

    【讨论】:

      猜你喜欢
      • 2019-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多