我在布局中使用SmartImageView并将 URL 设置如下
header.setImageUrl(welcomeScreen._headerImageUri, new SmartImageTask.OnCompleteListener() {
@Override
public void onComplete() {
int height = 0;
if (header.getDrawable() != null) {
height = (int) Math.round(((double) header.getWidth()) * ((double) header.getDrawable().getIntrinsicHeight()) / ((double) header.getDrawable().getIntrinsicWidth()));
}
header.setLayoutParams(new RelativeLayout.LayoutParams(header.getWidth(), height + 1));
}
});
布局参数已设置,我的标题占据了空间。但是图像没有显示。我不明白我做错了什么