【发布时间】:2016-07-28 05:21:09
【问题描述】:
我正在使用 Picasso 加载背景图像,并且我正在使用相对布局。背景图像需要时间来加载,有些甚至没有加载。我的一段代码是,
final int k = random.nextInt(20);
ImageView imageView= (ImageView)findViewById(R.id.backgrd);
TypedArray imgb = getResources().obtainTypedArray(R.array.backg);
int resourceId = imgb.getResourceId(k, 0);
Picasso.with(getApplicationContext()).
load(resourceId).
fit().
noPlaceholder().
into(imageView);
我也尝试使用 resize() Picasso Taking time to load images,但它不起作用。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/backgrd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
<ImageView
android:id="@+id/img1"
android:paddingTop="90dp"
android:layout_width="wrap_content"
android:layout_height="400dp"
/>
【问题讨论】:
-
您的简洁措辞问题是什么?
-
检查带宽或者图像是否存储在本地,然后使用 UniversalImageLoader
-
@RabidMutant 我没有收到你的问题。
-
我不确定您的问题是否是 (a) 为什么 picasa 不起作用? (b) 谁慢? (c) 我怎样才能做得更快? (d) 我如何在后台线程中执行此操作?或者 (e) 当 picasa 无法加载图片时我该怎么办?
-
让您的问题更加清晰具体。所以,你会得到更精确的解决方案。