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++)
             {
                     if(argb[i]!=0){
             argb[i] = (number << 24) | (argb[i] & 0x00FFFFFF);
             }
                     else{argb[i]=0x00000000;}
         }
             sourceImg = Bitmap.createBitmap(argb, sourceImg.getWidth(), sourceImg.getHeight(), Config.ARGB_8888);
             return sourceImg;
     }

           

参考一下,这是将为bitmap设置成透明的