List of usage examples for android.graphics.drawable GradientDrawable getIntrinsicHeight
@Override public int getIntrinsicHeight()
From source file:com.forrestguice.suntimeswidget.SuntimesUtils.java
/** * @param context context used to get resources * @param resourceID drawable resource ID to a GradientDrawable * @param fillColor fill color to apply to drawable * @param strokeColor stroke color to apply to drawable * @param strokePx width of stroke//from w ww .j a v a 2 s .com * @return a Bitmap of the drawable */ public static Bitmap gradientDrawableToBitmap(Context context, int resourceID, int fillColor, int strokeColor, int strokePx) { Drawable drawable = ResourcesCompat.getDrawable(context.getResources(), resourceID, null); GradientDrawable gradient = (GradientDrawable) drawable; int w = 1, h = 1; if (gradient != null) { w = gradient.getIntrinsicWidth(); h = gradient.getIntrinsicHeight(); } Drawable tinted = tintDrawable(gradient, fillColor, strokeColor, strokePx); return drawableToBitmap(context, tinted, w, h, true); }