How to make bitmap transparent?

前端 未结 6 748
夕颜
夕颜 2021-01-14 11:40
/**
 * @param bitmap
 *            The source bitmap.
 * @param opacity
 *            a value between 0 (completely transparent) and 255 (completely
 *            op         


        
6条回答
  •  伪装坚强ぢ
    2021-01-14 12:31

    @akaya's answer is the right way except that the constructor is deprecated. The new way since API 4 would be to use:

    BitmapDrawable drawable = new BitmapDrawable(getResources(), bitmap);
    drawable.setAlpha(100);
    

提交回复
热议问题