/**
* 图片透明度处理
*
* @param sourceImg
* 原始图片
* @param number
* 透明度
* @return
*/
public static Bitmap setAlpha(Bitmap sourceImg, int number) {
int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()];
sourceImg.getPixels(argb, 0, sourceImg.getWidth(), 0, 0,sourceImg.getWidth(), sourceImg.getHeight());// 获得图片的ARGB值
number = number * 255 / 100;
for (int i = 0; i < argb.length; i++) {
argb = (number << 24) | (argb & 0x00FFFFFF);// 修改最高2位的值
}
sourceImg = Bitmap.createBitmap(argb, sourceImg.getWidth(), sourceImg.getHeight(), Config.ARGB_8888);

return sourceImg;
}

更多相关文章

  1. android 图片叠加效果实现
  2. Android 图片缩放,图片圆角处理
  3. android典型代码系列(六)------drawable图片转换为48dip的bitmap
  4. android 异步下载图片
  5. Android 把Layout变成图片
  6. android之ListView和adapter配合显示图片和文字列表
  7. android 上传图片到服务器
  8. Android TextView中插入图片
  9. Android 调用系统的照相,浏览图片,转存并裁剪!

随机推荐

  1. Creating an iOS and Android Cocos2D-x
  2. Android网络状态实时监听器
  3. android中Activity传递参数之onActivityR
  4. EasyJWeb 1.3快速上手
  5. 学习MVVM遇到的Error记录
  6. 通过Android Studio 导出Jar包
  7. Android(安卓)底部导航栏BottomNavigatio
  8. android设置系统图标后手机上不显示出来
  9. Android中的数据结构
  10. Android里handler线程间的通信详解