首先定义一个图片接口
Uri uri = Uri.parse("http://img.zcool.cn/community/01307b57636e710000018c1b829c13.gif");
//控件获取图片的地址
img.setImageURI(uri1);
设置圆角图片
/* * 点击切换圆角 * */ public void jiao(View view){ //圆角的适用对象 RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f); //设置边框线颜色及宽度 roundingParams.setBorder(R.color.red,1.0f); //制定位置圆角 roundingParams.setCornersRadii(25,25,0,0); //图片关联 img.getHierarchy().setRoundingParams(roundingParams); }设置圆形图片/* * 点击切换圆型 * */ public void yuan(View view){ //圆角的适用对象 RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f); //圆圈设置为true roundingParams.setRoundAsCircle(true); //图片关联 img.getHierarchy().setRoundingParams(roundingParams); }网络图片动图/* * 点击切换网络图片动图 * */ public void huan(View view){ //对动态图片的控制 DraweeController controller = Fresco.newDraweeControllerBuilder() //加载路径 .setUri(uri) //允许自动播放 .setAutoPlayAnimations(true) // 其他设置(如果有的话) .build(); //空间引用方法对象 img.setController(controller); }点击加载图片public void onClick(View view) { jia.setVisibility(View.GONE); // 图片的地址 Uri uri = Uri.parse("http://img4q.duitang.com/uploads/item/201304/27/20130427043538_wAfHC.jpeg"); // 图片的请求 ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) .build(); // 加载图片的控制 PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder() .setOldController(simpleDraweeView.getController()) .setImageRequest(request) .build(); // 加载图片 simpleDraweeView.setController(controller); // 将simpleDraweeView控件对象,添加到线性布局中 lin.addView(simpleDraweeView); }动态图的开始停止//架子啊一张动态图片 add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //图片设置对象-----如果可播放动态为true将循环播放 AbstractDraweeController draweeController = Fresco.newDraweeControllerBuilder() .setUri(parse) .setAutoPlayAnimations(true) .setOldController(img.getController()) .build(); //关联控件 img.setController(draweeController); } }); /* * 停止播放 * */ stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //获取gif状态 Animatable animatable = img.getController().getAnimatable(); if(animatable!=null&&animatable.isRunning()){ animatable.stop(); } } }); /* * 播放 * */ move.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //获取gif状态 Animatable animatable = img.getController().getAnimatable(); if(animatable!=null&&!animatable.isRunning()){ animatable.start(); } } });进度条加载的图片Uri uri = Uri.parse("http://pic36.photophoto.cn/20150717/0008020273556228_b.jpg"); // 设置显示图片 jinImg.setImageURI(uri); jinImg.getHierarchy().setFadeDuration(3000); jinImg.getHierarchy().setProgressBarImage(new ProgressBarDrawable());缩放修改图片的清晰度/* * 修改图片 * */ public void gai(View view){ int width=50; int heigh=50; //创建图片路径 Uri uri = Uri.parse("http://pic36.photophoto.cn/20150717/0008020273556228_b.jpg"); //创建图片的方法 ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) .setResizeOptions(new ResizeOptions(width, heigh)).build(); PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder() .setOldController(img.getController()) .setImageRequest(request) .build(); img.setController(controller); }