• 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; Rect myRect; 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!
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones