/** * 1101 0111 1000 1011 * 1111 1111 * 1000 1011 * percent 透明度,百分比 * rgb 传入的色值 */ protected int getTranslucentColor(float percent, int rgb) { // 10101011110001111 int blue = Color.blue(rgb); int green = Color.green(rgb); int red = Color.red(rgb); int alpha = Color.alpha(rgb); // int blue = rgb & 0xff; // int green = rgb>>8 & 0xff; // int red = rgb>>16 & 0xff; // int alpha = rgb>>>24; alpha = Math.round(alpha*percent); return Color.argb(alpha, red, green, blue); }
安卓中透明度的修改
最新推荐文章于 2019-11-07 11:24:27 发布