当我使用fit()时Android Picasso没有加载图片

Mah*_*hen 2 android android-imageview picasso

没有fit()它工作正常.
.Picasso.with(getApplicationContext())的负载(url.concat(featureImage))代入(ImageView的).

ImageView imageView = (ImageView)findViewById(R.id.featureImage);
TextView textTitle = (TextView)findViewById(R.id.title);
TextView textDetail = (TextView)findViewById(R.id.detail); 
 Picasso.with(getApplicationContext()).load(url.concat(featureImage)).fit().into(imageView);
textTitle.setText(title);
textDetail.setText(detail);
Run Code Online (Sandbox Code Playgroud)

小智 5

  • fit() - 尝试调整图像大小以完全适合目标ImageView的边界.

所以,如果你设置layout_widthlayout_height您的ImageView的"WRAP_CONTENT"并没有设定最低可能的大小,高度或视图的宽度将最初为0,你的形象也会相应调整.