Scale transformation in ImageView
<p>I am using Android Image Gallery to show images. Now I would like to change the code to sometimes show the image or to draw my own shapes. I am trying to add to the BitmapDrawable passed onto the gallery setImageDrawable function my own MyDrawable which inherits from Drawable. The issue is that MyDrawable is not scaling correctly to the ImageView size as the BitmapDrawable is. I belive the Image view is calling some special methods available only to the BitmapDrawable and not to the Drawable. 
Here is the code.</p>

<pre><code>  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
     Resources res = getContext().getResources();     
     ImageView view = new ImageView(getContext());
     view.setImageDrawable(getItem(position).getImage(res));
     view.setLayoutParams(new Gallery.LayoutParams(150, 100));
     view.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
     view.setBackgroundResource(galleryItemBackground);
   return view;
 }
</code></pre>

<p>if the getItem(position).getImage(res) returns BitmapDrawable type all works fine, if it returns MyDrawable it is not scaling correctly. Any idea?</p>
