I want to programmatiacally set the larger Image as background of ImageButton in Android and set its height and width as fixed. I am able to create the Image Button as follow. But the Image comes larger as its size. How to fix its size according to the button’s size.
ImageButton b0=new ImageButton(this);
b0.setMaxWidth(100);
b0.setMinimumWidth(100);
b0.setMaxHeight(80);
b0.setBackgroundResource(R.drawable.tattoo0);
tattooListView.addView(b0);
Thanks in advance
This code helped me to achieve my target.