Dip/scale/xdpi/ydpi

wimpie3

Well-Known Member
Licensed User
Longtime User
I have noticed that when I want to draw a rectangle with a width of 50%x, and then set the height to that value, my rectangle is stretched out a bit.

I always thought the scale and the dips were equal horizontally and vertically, but on my phone I have found out that the xdpi and ydpi values are different, hence the stretching.

Does this mean I have to calculate all heights myself for perfect rectangles according to the xdpi/ydpi ratio? Or how should I handle this in Basic4Android?
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Erel, this seems rather important to me. This means that EVERYTHING concerning the scale in basic4android (autoscale, DIP, ...) is NOT 100% correct? So basically you have to do the xdpi and ydpi math yourself when you want pixel perfect alignment?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This means that EVERYTHING concerning the scale in basic4android (autoscale, DIP, ...) is NOT 100% correct?
This density related features are Android features not Basic4android. They (Google) decided to use a single logical density to make it simpler for standard apps. The logical density is an approximation. If you need exact real-world measures then you need to use xdpi and ydpi.
 
Upvote 0
Top