Sirke
Sirke

Reputation: 33

Relative position to point on picture across screens

I am trying to place textView on specific position related to point on picture (name of pin, which must be editable), I'am facing problem when using different screen size, so I is there any way to make this work. I tried on some of my phones :

-4.3', 720 x 1280 pixels (~342 ppi density) 
-4.0', 480 x 800 pixels, (~233 ppi density) 
-5.1' 1440 x 2560 pixels (~577 ppi density)

When I make it work for one device it doesn't work for other two

I would like to make it like this

Upvotes: 1

Views: 45

Answers (1)

Gabe Sechan
Gabe Sechan

Reputation: 93678

Scale the position of the text field by the same factor you scale up the image by.

scaledX=  x_on_disk*image_width_on_screen/image_width_on_disk
scaledY=  y_on_disk*image_height_on_screen/image_height_on_disk

Upvotes: 1

Related Questions