How to use ColorDrawable with ImageView?
- by user246114
Hi,
I have a layout with an ImageView defined like:
<ImageView
android:layout_width="45dip"
android:layout_height="45dip"
android:scaleType="fitXY" />
now I just want to set the imageview to be a static color, like red or green. I'm trying:
ColorDrawable cd = new ColorDrawable("FF0000");
cd.setAlpha(255);
ImageView iv = ...;
iv.setImageDrawable(cd);
the imageview is just empty though, no color. The 45dip space is being used up though. What do I need to do to get the color to be rendered?
Thanks