wimpie3 Well-Known Member Licensed User Longtime User Aug 10, 2016 #1 When I draw a rectangle on the Activity having width = activity.width and height = activity.width (which means the rectangle has the same width as height) the resulting rectangle is NOT a perfect rectangle. It looks higher than its width. What am I missing here? A pixel density problem? How can I draw a perfect rectangle?
When I draw a rectangle on the Activity having width = activity.width and height = activity.width (which means the rectangle has the same width as height) the resulting rectangle is NOT a perfect rectangle. It looks higher than its width. What am I missing here? A pixel density problem? How can I draw a perfect rectangle?
NJDude Expert Licensed User Longtime User Aug 10, 2016 #2 What you are doing is drawing a square not a rectangle. e.g: Activity.Width = 100dip According to your code posted above: Width = 100dip Height = 100dip Upvote 0
What you are doing is drawing a square not a rectangle. e.g: Activity.Width = 100dip According to your code posted above: Width = 100dip Height = 100dip
wimpie3 Well-Known Member Licensed User Longtime User Aug 10, 2016 #3 Exactly what I'm saying: a square with 100dip x 100dip looks like a rectangle on my mobile! Upvote 0
klaus Expert Licensed User Longtime User Aug 10, 2016 #4 You should post your code, or better post a small project showing the problem ! Without seeing your it's impossible to give a concrete advice ! Upvote 0
You should post your code, or better post a small project showing the problem ! Without seeing your it's impossible to give a concrete advice !
ivan.tellez Active Member Licensed User Longtime User Aug 11, 2016 #5 The exact physical pixels per inch of the screen in the X dimension could be not the same as in the Y dimension. "dip" are units independ. Try: Code: Sub Activity_Create (FirstTime As Boolean) Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod("getResources") r.Target = r.RunMethod("getDisplayMetrics") Log(r.GetField("xdpi")) Log(r.GetField("ydpi")) End Sub Upvote 0
The exact physical pixels per inch of the screen in the X dimension could be not the same as in the Y dimension. "dip" are units independ. Try: Code: Sub Activity_Create (FirstTime As Boolean) Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod("getResources") r.Target = r.RunMethod("getDisplayMetrics") Log(r.GetField("xdpi")) Log(r.GetField("ydpi")) End Sub