Picasso使用的方法汇总:
来源:互联网 发布:乾隆下江南 知乎 编辑:程序博客网 时间:2024/06/15 23:15
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);Picasso.with(context).load(url).into(view);Picasso.with(context).load(url) .resize(50, 50).centerCrop().into(imageView)//这里的placeholder将resource传入通过getResource.getDrawable取资源,所以可以是张图片也可以是color idPicasso.with(context).load(url).placeholder(R.drawable.user_placeholder).error(R.drawable.user_placeholder_error).into(imageView);Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);Picasso.with(context).load(new File(...)).into(imageView3);//这里显示notification的图片Picasso.with(activity).load(Data.URLS[new Random().nextInt(Data.URLS.length)]).resizeDimen(R.dimen.notification_icon_width_height,R.dimen.notification_icon_width_height).into(remoteViews, R.id.photo, NOTIFICATION_ID, notification);//这里是通过设置tag标签,就是当前传过来的context,这样就可以根据这个context tag来pause和resume显示了Picasso.with(context).load(url).placeholder(R.drawable.placeholder).error(R.drawable.error).fit().tag(context).into(view);//监听onScrollStateChanged的时候调用执行picasso.resumeTag(context);picasso.pauseTag(context);Picasso.with(context).load(contactUri).placeholder(R.drawable.contact_picture_placeholder).tag(context).into(holder.icon);//这个onpause方法里的这段代码还是很有意思的@Override protected void onPause() { super.onPause(); if (isFinishing()) { // Always cancel the request here, this is safe to call even if the image has been loaded. // This ensures that the anonymous callback we have does not prevent the activity from // being garbage collected. It also prevents our callback from getting invoked even after the // activity has finished. Picasso.with(this).cancelRequest(imageView); } }// Trigger the download of the URL asynchronously into the image view. Picasso.with(context) .load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .resizeDimen(R.dimen.list_detail_image_size, R.dimen.list_detail_image_size) .centerInside() .tag(context) .into(holder.image);//Picasso.with使用的是单例模式Picasso.with(this).cancelTag(this);
0 0
- Picasso使用的方法汇总:
- picasso框架的使用
- Picasso的使用
- picasso的使用
- Picasso框架的使用
- Picasso的使用
- Picasso的使用
- Picasso的使用
- Picasso的基本使用
- Picasso的使用
- Picasso的使用
- Picasso框架的使用
- Picasso的基本使用
- Picasso框架的使用
- Picasso的使用总结
- Picasso的详细使用
- Picasso的使用
- Picasso的使用
- html5解决大文件断点续传
- java中与接口有关的匿名类详解
- weblogic下发步骤使用命令行代替控制台界面
- 会计科目****不能使用(请更正)
- MacOS安装并使用Drozer总结
- Picasso使用的方法汇总:
- 类中const
- Linux常用命令
- 数据库-事务
- 水题,模拟(nefu 1152 阿里巴巴致富的秘密)
- android 国际化
- C语言学习要点
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- 第五周项目二(3)计算工资