Android 使用毕加索动态加载ImageButton图像
我正在尝试将许多图像按钮加载到Android 使用毕加索动态加载ImageButton图像,android,picasso,android-imagebutton,Android,Picasso,Android Imagebutton,我正在尝试将许多图像按钮加载到滚动视图中。这是我正在使用的代码 Picasso.with(getContext()).load(url).into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { BitmapDrawable bdrawable = new BitmapDrawable(bitmap); btn
滚动视图中。这是我正在使用的代码
Picasso.with(getContext()).load(url).into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
BitmapDrawable bdrawable = new BitmapDrawable(bitmap);
btn.setBackground(bdrawable);
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.topMargin = 0;
btn.setLayoutParams(params);
btn.setAdjustViewBounds(true);
btn.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
scrollLayout.addView(btn);
但是图像并没有按预期加载。出什么事了
谢谢。什么问题?“未按预期加载”是什么意思?