问题描述
dependency=implementation "com.squareup.picasso:picasso:2.4.0"
String url1="https://www.google.com/search?
ImageView image;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image= (ImageView)findViewById(R.id.image);
Picasso.with(this)
.load(url)
.placeholder(R.drawable.ic_launcher_foreground)
.resize(200,200) //optional
.centerCrop() //optional
.into(image);
}
}
解决方法
首先请添加此网址,并确认图片未上传:
https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg
Picasso.with( context )
.load( your_path )
.error( R.drawable.ic_error )
.placeholder( R.drawable.progress_animation )
.into( image_view );