Android App elements all in top left corner lazarus / 43-Android ---------------------------------------------------------------------- pdhcentral · 2020-09-03 20:11 Hi, I can build an Android app and it installs fine. The elements, like buttons, text, etc are all on top of one another in the top left corner of the screen. I've tried different form sizes in lazarus but not really sure what else to try. Any ideas? Android 10, using OpenJDK and latest Laz4Android and Lazarus. ---------------------------------------------------------------------- jmpessoa · 2020-09-03 20:32 From docs: https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW_Ge tting_Started.txt 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". ---------------------------------------------------------------------- shyub · 2020-09-04 08:04 And what to do if you need to place horizontally 3 buttons of the same size and so that when you change the screen resolution, they retain their proportions? When should you use the "LayoutParamWidth = lpMatchParent" property? When should you use the "PosRelativeToAnchor / raToStartOf = true" property? How to make a round button with a picture so that the proportions of the picture are not disturbed when the screen size is changed? Thank. ---------------------------------------------------------------------- Handoko · 2020-09-04 09:00 LAMW is only a tool to connect Lazarus with Android API. You will get better information if you search how the API works on Android documentation. LayoutParamWidth = lpMatchParent means the component width is the the same as its parent. Which is useful if you want to make the component full width. For example you want the screen to have 2 buttons: yes and no. And you want to put the no button right below the yes and both of them are as wide as the screen. I found this videos maybe useful to you: https://www.youtube.com/watch?v=gkh-5pmYEa0 https://www.youtube.com/watch?v=X9LSVmh9KGY To me, the easiest way to understand it is to try to set the value, compile, run and see the result myself. ---------------------------------------------------------------------- jmpessoa · 2020-09-04 18:04 LAMW will try retain their proportions for you! Can you put here a screen "sketch/draft"  figure? ---------------------------------------------------------------------- shyub · 2020-09-04 19:14 I want to make a cutting machine that can be controlled by Bluetooth from a tablet or phone. Here is a sketch of the appearance. ---------------------------------------------------------------------- shyub · 2020-09-04 19:28 I have already done something similar on Lazarus + OpenGL, but under Windows. Now I want to try to make something easier on Android. ---------------------------------------------------------------------- shyub · 2020-09-04 19:37 I found an article on component binding on the Russian domain: https://ru-code-android.livejournal.com/4327.html ---------------------------------------------------------------------- jmpessoa · 2020-09-05 03:21 A simple example [attachment] and screenshot.... Now you have a start point.... ---------------------------------------------------------------------- shyub · 2020-09-05 15:32 Спасибо за AppCuttingMachineSketch1! Многое стало ясно. Однако при построении примера, а также других, где jImageBtn используется при построении проекта, возникает ошибка. Я пробовал строить с Ant и Grable вместе с: - android-ndk-r14b, android-ndk-r18b, android-ndk-r21d; - android-sdk_r24.4.1, android-sdk_r25.2.5, android-sdk_26-1-1; - apache-ant-1.9.14, apache-ant-1.9.15, apache-ant-1.10.8; - gradle-4.4.1; Переустановил lazandroidmodulewizard-master. Операционная система - Windows-7x86. Среда - laz4android2.0.0-FPC3.0.4. Что еще можно сделать? Есть ли смысл переустанавливать Windows и использовать lazarus-2.0.10-fpc-3.2.0-win32? ---------------------------------------------------------------------- shyub · 2020-09-05 15:34 Ant ---------------------------------------------------------------------- jmpessoa · 2020-09-05 17:01 Please, update your LAMW from github.... (your "Controls.java"  is missing "pOnUp" native method need by jImageBtn ) ---------------------------------------------------------------------- shyub · 2020-09-05 18:39 Thank you so much jmpessoa! Everything worked out.