public class MymaskActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imageView=(ImageView)findViewById(R.id.imageView1);
imageView.setImageBitmap(getRoundedCornerBitmap());
}
public Bitmap getRoundedCornerBitmap() {
Resources res = getResources();
Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.fang);
Bitmap dst = BitmapFactory.decodeResource(res, R.drawable.yuan);

Canvas canvas = new Canvas(bmp);
final int color = 0xff424242;
final Paint paint = new Paint();


paint.setAntiAlias(true);
// canvas.drawARGB(0, 0, 0, 0);
// paint.setColor(color);
//
paint.setXfermode(new PorterDuffXfermode(Mode.XOR));

canvas.drawBitmap(dst, 0, 0, paint) ;
return bmp;
}
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. TextView(标签控件)
  2. Android(安卓)TextView行间距解析
  3. Android系统自带样式(android:theme)
  4. Android(安卓)SDK下载和更新失败的解决方
  5. Linearlayout和relativeLayout的属性的一
  6. Android(安卓)layout_margin 无效的解决
  7. 什么是Android——Android平台简介
  8. EventBus 《三》 事件的具体用法及其讲解
  9. android 入门xml布局文件
  10. Androd学习笔记——Conflict between And