StableBorderLayout is similar to SimpleLayout. However, there are two differences between the two. No spacing attribute is allowed in StableBorderLayout and it ignores all views but the last three. The second last view will be stretched to fill the rest of the container’s width/height.
Table 4.6 shows the attribute in StableBorderLayout.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
axis | Tag and JS | string | y | read-write |
Description. The axis to lay out components. The value for this attribute is either “x” or “y”. |
Listing 4.9 shows an LZX application that uses StableBorderLayout.
<canvas height="100"> <stableborderlayout axis="x"/> <view width="60" height="60" bgcolor="red"/> <view width="30" height="60" bgcolor="silver"/> <view width="30" height="60" bgcolor="black"/> <view width="60" height="60" bgcolor="gray"/> </canvas> |
To compile the code, use this URL:
http://localhost:8080/lps-4.0.x/app04/stableLayoutTest1.lzx
The generated output is shown in Figure 4.9.
Note that the red view is ignored. The gray view takes the first place and the silver view is stretched.