I have an imageButton of size 52x24, this image will be change size when loading:
ImageButton blueButton = (ImageButton) findViewById(R.id.button_blue_normal); LayoutParams lpb = new LayoutParams((int) (52 * 1.25),(int) (24 * 1.25)); lpb.setMargins((int) (15 * 1.25), (int) (75 * 1.25), 0, 0); blueButton.setLayoutParams(lpb); blueButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { blueButton.setImageResource(R.drawable.button_blue_pressed); } }); The above code working without problems, in the exact position and size needed. The problem is when the image is load after the onClick, the image button_blue_pressed is displayed in original size 52x24 over the previous image button_blue_normal that is larger. how I can do to make the image button_blue_pressed the same size as the previous button_blue_normal ? Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en