Recent

Author Topic: LAMW anchors  (Read 768 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
LAMW anchors
« on: August 03, 2019, 02:06:06 pm »
Hi guys, I haven't used LAMW and android programming for a few years. I know it will be a trivial question, but I don't remember how to handle the objects anchors
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

jmpessoa

  • Hero Member
  • *****
  • Posts: 2302
Re: LAMW anchors
« Reply #1 on: August 03, 2019, 06:46:08 pm »


from:
https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW_Getting_Started.txt

Quote
[FAQ 2]: [Thanks to Ahmad Bohloolbandi (a.k.a. @developing) ]

#Question: How do we can design a layout that shown same in real device?

[Answer]: You should use the component properties:

      "Anchor",
      "PosRelativeToParent",
      "PosRelativeToAnchor",
      "LayoutParamHeight",
      "LayoutParamWhidth"
         
Example:

1-Put a "jTextView" component on your AndroidModule form:

   Set "PosRelativeToParent"
      "rpCenterHorizontal" [True]
      "rpTop" [True]

2-Put a "jButton" component on AndroidModule form:

   Set "Anchor" to "jTextView" (Because you should set position relative with "jTextView")
   set "PosRelativeToAnchor"
      "raBelow" [True]

3-Put a "jEditText" component on form:

   Set "Anchor" to "jButton".
   Set "PosRelativeToAnchor"
      "raBelow" [True]

NOTE:    Anchor setting is most important section of this design,
   because your component position depends on this property.
   And for change width and/or height of each components you should
   change/configure "LayoutParamWhidth" and/or "LayoutParamHeight".

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: LAMW anchors
« Reply #2 on: August 04, 2019, 11:50:46 pm »
Thank you very much :)
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018