User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.09 is out since May 6th 2021
After a brief pause DroidScript is now available again from the Google Play Store


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

getting_started:tut1

Tutorial on Layout

In the wiki comments a user had difficulty placing a text box and an image. Here's an intro.

Let's start with Hello World (which is provided with DS and shows an image and some text.
Initially the code has

lay=app.CreateLayout("linear","VCenter,FillXY");

This creates a layout where the elements are centred vertically, and the layout fills the screen top-to-bottom and left-to-right.
If we remove VCenter (and the comma) then the elements appear at the top of the screen.
Try it.
If we then want the elements to be side by side and on the left, add Horizontal and Left
Let's also drop the FillXY because we aren't putting elements in the centre of the screen.

lay=app.CreateLayout("linear","Horizontal,Left");

The text box has margins (space between elements)
0 to the left,
0.05 (5 percent of the screen) above,
0 to the right,
0 below.
Try giving it a margin of 20 percent of the screen on the left, and no margin at the top by changing to

txt.SetMargins(0.2,0,0,0);

Or you can specify sizes in pixels, for example a margin on the left of 20 pixels

txt.SetMargins(20,0,0,0,"px");

There are many other possibilities (setting widths and heights, padding, layouts within layouts).
See the documentation of Layouts and Controls.

getting_started/tut1.txt · Last modified: 2021/08/11 16:49 by al4he6