我需要Picasso库帮助您,我正在尝试从毕加索的Firebase加载多个图像,问题是 该图像存在但未显示。这意味着当我单击空白盒时,我可以在其他地方显示它,并且当我切换活动并回来时,将显示图像。
图片的网址有效,我的互联网权限已打开。
这是代码:
public void loadImageInBackground(UnderProducts underProd, final String tableImage, final ImageView imageUnderProdTop) {
target = new Target() {
@Override
public void onPrepareLoad(Drawable arg0) {
Log.e("picassoLoad","bitmap preparation");
}
@Override
public void onBitmapLoaded(Bitmap arg0, Picasso.LoadedFrom arg1) {
Log.e("PicassoLoadedFrom",arg1.name());
Log.e("PicassoItem",arg0.toString());
if(tableImage.equals("normal"))
{
imageTable.add(arg0);
}else if(tableImage.equals("top"))
{
imageTopTable.add(arg0);
}
if(imageUnderProdTop!=null)
{
imageUnderProdTop.setImageBitmap(arg0);
}
}
@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
Log.e("picasso","bitmap failed");
Log.e("picassoError",e.getMessage());
}
};
Picasso.get()
.load(underProd.getImgId()).into(target);
}
位图图像大小表为0
ImageView[] imgTab = {top_1_img, top_2_img, top_3_img, top_4_img, top_5_img, top_6_img, top_7_img, top_8_img};
for(int x=0;x<top_eight.size();x++) {
loadImageInBackground(top_eight.get(x),"top",imgTab[x]);
}
if(o<70)
{
o+=10;
anim.setProgress(o);
}
Toast.makeText(Accueil.this,String.valueOf(imageTopTable.size()),Toast.LENGTH_SHORT).show();
for(int l=0;l<imageTopTable.size();l++)
{
imgTab[l].setImageBitmap(imageTopTable.get(l));
}
我的Build.Gradle文件配置:
compileSdkVersion 26
defaultConfig {
applicationId "com.hasardpunk.lista"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-firestore:17.1.0'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.github.onlylemi:mapview:v1.0'
implementation project(':library')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
}