Tooth uncle tutorial is easy to understand

Someone asked me how to write such a layout

The height of control 2 is fixed, and the remaining space is given to control 1.

  • Method 1: use layout_weight
"ui";
ui.layout(
  <vertical>
    <vertical id="up" bg="#7bed9f" layout_weight="1"></vertical>
    <vertical id="down" bg="#70a1ff" h="100dp"></vertical>
  </vertical>
);
Copy the code
  • Method 2: Use margin
"ui";
ui.layout(
  <frame>
    <vertical id="up" bg="#7bed9f" h="*" marginBottom="100dp"></vertical>
    <vertical id="down" bg="#70a1ff" h="100dp" layout_gravity="bottom"></vertical>
  </frame>
);
Copy the code

Method 3: Use padding

ui.layout(
  <frame>
    <vertical id="up" bg="#7bed9f" h="*" paddingBottom="100dp"></vertical>
    <vertical id="down" bg="#70a1ff" h="100dp" layout_gravity="bottom"></vertical>
  </frame>
);
Copy the code

Quotes.

Ideas are the most important, other Baidu, Bing, StackOverflow, Github, Android docs, AutoJS docs, and last but not least, ask in the group

The statement

This tutorial is intended for learning purposes only and is not intended for any other use