I am setting a drawable for a progress dialog (pbarDialog
) but my issue is I want to resize the drawable each time but can\'t figure out how.
Here is so
Maybe my solution covers the question not completely, but I needed something like a "CustomDrawable".
In other words, I want to set a logo in front of a circle shape. So I created a FrameLayout with a background (just a colored circle) and in front of this round shape I show the logo.
To resize the logo I shrink the logo by scaling - here is some code:
iv = new ImageView(mContext);
iv.setScaleX(0.75f); // <- resized by scaling
iv.setScaleY(0.75f);
// loading the drawable from a getter (replace this with any drawable)
Drawable drawable = ML.loadIcon(mContext, Integer.parseInt(icon));
iv.setImageDrawable(drawable);
// icon get's shown inside a ListView
viewHolder.mIvIcon.addView(iv);
Here is the FrameLayout which shows the icon inside ListView's row:
See this solution as an option / idea.