EDIT:
Ahh...it is because you are not casting the right thing as an int. You are casting 0.7 as an int (which goes to zero) and then multiplying it, instead of multiplying and then casting. You can use (int) (.7 * width)
instead of (int) .7 * width
.
See my example: http://ideone.com/NSGwGF
Anyway, my advice below still stands.
Why not use:
btn.setWidth((int) Math.round(.7 * width));
btn.setHeight((int) Math.round(.7 * height));
instead of:
ViewGroup.LayoutParams params = btn.getLayoutParams();
params.width = (int) .7 * width;
params.height = (int) .7 * height;
btn.setLayoutParams(params);