• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps SetBounds(Rect r) on BitmapDrawable problem


I want to set the setBounds method on a BitmapDrawable.

The BitmapDrawable will be attached in a imageView, and the

imageView will be added in a relative layout.

I tried to call the setBounds method for the bitmapDrawable and
for the imageView. But in both cases, does nothing.

Any ideas?
my code is :






[HIGH]
Class myClass extends RelativeLayout{
private BitmapDrawable myDrawable;
private Rect myRect;
private ImageView imgView;

public myClass(Context context){
super(context);
this.myDrawable = (BitmapDrawable)this.getResources().getDrawable(R.drawable.mypic);


this.myRect = new Rect(10,10,100,100);
this.myDrawable.setBounds(myRect); // DOES NOTHING!
this.imgView = new ImageView(context);
this.imgView.setImageDrawable(myDrawable);
this.addView(imgView);
}
[/HIGH]Any ideas??
Thank you!
 
Back
Top Bottom