【发布时间】:2014-02-19 06:48:11
【问题描述】:
我正在制作一个在列表视图中显示来自 url 的图像的应用程序。我使用异步任务来获取图像并将其放入图像视图中。我目前拥有的方式是在 getview 方法中调用 asynctask。 do in background 部分从 url 获取图像。我遇到的问题是当我滚动到列表视图中的一个元素时,最初存在错误的图像,但正确的图像很快加载。为什么会这样?
xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitStart"
android:src="@drawable/ic_launcher" />
</LinearLayout>
【问题讨论】:
-
请发布您的列表行布局?
标签: android android-asynctask android-imageview