Android Question How to position bitmap to be in the same place on all screen sizes?

0CrimsonScythe0

Member
Licensed User
Longtime User
Hey,
I have initialized a bitmap using dip values
B4X:
tri.DestRect.Initialize(90dip , 275dip , 280dip , 420dip)

Its a triangle which i want to appear a little below the middle of the screen. It is appearing fine on my moto g but on another device I have the triangle is in the bottom right and only the top is visible the rest is out of the screen. Shouldn't the triangle be in the same position on both devices?How exactly are bitmaps initialized ? Are dip values used or something else? My moto g is 4.5 inches and the other deivce is 5 inches.

Thanks, I am new to b4a by the way
 

0CrimsonScythe0

Member
Licensed User
Longtime User
OK so I have changed the code a bit
B4X:
tri.DestRect.Initialize(25%x , 60%y , 75%x , 90%y)
the triangle now appears perfectly on both devices but is this the right way to do it? Because in the examples i have seen, dip values are used.
 
Upvote 0
Top