ConstantBoundsLayout

ConstantBoundsLayout is similar to ConstantLayout, but it ignores the xoffset attribute value of any view if the layout’s axis attribute is assigned “x” and ignores the yoffset attribute value of any view if the value of the layout’s axis attribute is “y”.

Table 4.8 shows the attributes defined in the ConstantBoundsLayout class.

Table 4.8. The attributes defined in the ConstantLayout class
NameUsageTypeDefaultAccessibility
axisTag and JSstringyread-write
 Description. The axis to lay out components along. The value for this attribute is either “x” or “y”.
valueTag and JSstring read-write
 Description. The number of pixels the axis is shifted from.

For example, the code in Listing 4.11 shows how to use ConstantBoundsLayout.

Listing 4.11. Using ConstantBoundsLayout
<canvas height="80">
    <include href="utils/layouts/constantboundslayout.lzx"/>
    <constantboundslayout axis="x" value="10"/>
    <view width="80" height="80" bgcolor="silver" xoffset="-5"/>
    <view width="60" height="60" bgcolor="gray"/>
    <view width="40" height="40" bgcolor="black"/>
</canvas>

Note that you need to include the constantboundslayout.lzx file in the utils/layouts directory to use ConstantBoundsLayout.

To compile the code, use this URL:

http://localhost:8080/lps-4.0.x/app04/constantBoundsLayoutTest1.lzx

Figure 4.11 shows the generated output.

Figure 4.11. Using ConstantBoundsLayout


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

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