Android Question Help Needed: Custom View Size and Dimensions in Designer Do Not Match Log Output in Code

As shown in the screenshot, I added a custom component ContrastInputBox (which is represented by a placeholder in the designer), and set its size and dimensions. Then, I tested the size and position of mbase object in the DesignerCreateView method of the component's implementation code. However, the results I get are inconsistent with the Designer interface's property values. Could anyone explain why this is happening? My phone device is 720 x 1399, scale=2 (320 dpi).
Thanks!


b4x:
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
    mBase = Base
    Tag = mBase.Tag
    mBase.Tag = Me
    '...
    Log("boxsize=" & mBoxSize)
    Log("mbase.width=" & mBase.Width) 'inconsistent value
    Log("mbase.heigt=" & mBase.height) 'inconsistent value
    Log("mbase.left=" & mBase.Left)   'inconsistent value
    Log("mbase.top=" & mBase.Top)  'inconsistent value
    
end sub

Log output:
mbase.width=575
mbase.heigt=221
mbase.left=88
mbase.top=442
 

Attachments

  • Snipaste_2025-02-03_16-32-54--.png
    Snipaste_2025-02-03_16-32-54--.png
    30.4 KB · Views: 39
Top