简体   繁体   中英

(others too)picasso is not working with simple image display using URL

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);
    }
}

First please add this URL, and confirm that the image is not uploading:

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 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM