Can I scale a View in Android?
For scale, I resize the width
and height
of the view to make it affect the area and position another view
.
If you don't want it affect the area and position, use answer of @Gadzair
and @Taiti
private void resize(View view, float scaleX, float scaleY) { ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.width = (int) (view.getWidth() * scaleX); layoutParams.height = (int) (view.getHeight() * scaleY); view.setLayoutParams(layoutParams);}
Example using
resize(view, 0.5f, 0.8f);