0

I have an image as background in my android application. The image contains some leaves in it (like image map). To let the user to click on the leaves, I've put some Button View on each of the buttons in the image. For the app to be scalable in size, I calculate the left, top, width and height for the new size dynamically with formula below (for example for left parameter):

left = left * newWidth / oldWidth

Frankly speaking, it works fine. But I think there must be a better way to do this job in android. If so, what is that best way?

mehrdad seyrafi
  • 3,084
  • 2
  • 19
  • 16

1 Answers1

0

You can use 9-patch images , which automatically scale images/buttons up depending on the screen size and resolution , thereby always keeping the aspect ratio the same.

Akil
  • 719
  • 13
  • 23
  • 9-path images just is dynamically adjusted to the prepared view. But I want the position and size of the view to be dynamically adjusted – mehrdad seyrafi Feb 05 '15 at 23:53