Convert GradientDrawable to Bitmap
问题 I have the following gradient (generated dynamically): GradientDrawable dynamicDrawable = new GradientDrawable(); dynamicDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); dynamicDrawable.setUseLevel(false); int colors[] = new int[3]; colors[0] = Color.parseColor("#711234"); colors[1] = Color.parseColor("#269869"); colors[2] = Color.parseColor("#269869"); dynamicDrawable.setColors(colors); and I want to set that drawable in a view using onDraw method. When I want to assign a Drawable