StableBorderLayout

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.

Table 4.6. The attribute defined in the StableBorderLayout class
NameUsageTypeDefaultAccessibility
axisTag and JSstringyread-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.

Listing 4.9. Using 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.

Figure 4.9. Using StableBorderLayout


Note that the red view is ignored. The gray view takes the first place and the silver view is stretched.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset