I set an image to a RadioButton's drawableLeft, but it's to big. I want to set the image's height, width and scaleType in order to let it looks ok, just like in an ImageView:
android:layout_width="30dip"
android:layout_height="30dip"
android:scaleType="fitXY"
But i find there are no attributions for image when it's set in drawableLeft.
Is there any ways to solve this.
Is it possible to handle this in XML ?
I think this should work:
Drawable drawable = context.getResources().getDrawable(id);
drawable.setBounds(0, 0, 30, 30);
radioButton.setCompoundDrawables(drawable, null, null, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With