private Icon getIcon(String subreddit, @DrawableRes int overlay) {
Bitmap color = Bitmap.createBitmap(toDp(this, 148), toDp(this, 148), Bitmap.Config.RGB_565);
color.eraseColor(Palette.getColor(subreddit));
color = clipToCircle(color);
Bitmap over = drawableToBitmap(ResourcesCompat.getDrawable(getResources(), overlay, null));
Canvas canvas = new Canvas(color);
canvas.drawBitmap(over, color.getWidth() / 2 - (over.getWidth() / 2),
color.getHeight() / 2 - (over.getHeight() / 2), null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return Icon.createWithBitmap(color);
}
return null;
}
MainActivity.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:Slide
作者:
评论列表
文章目录