ConstantLayout

This layout places views on top of each other. As with SimpleLayout, you specify the axis attribute. The value attribute specifies the number of pixels the axis is shifted from. Any view managed by ConstantLayout may have its xoffset and yoffset attributes assigned a value. The xoffset attribute shifts the view to the right or to the left. The yoffset attribute causes the view to be shifted vertically.

Table 4.7 shows the attributes defined in the ConstantLayout class.

Table 4.7. 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.10 shows how to use ConstantLayout.

Listing 4.10. Using ConstantLayout
<canvas height="80">
    <constantlayout 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>

To compile this code, invoke the following URL:

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

Upon successful compilation, you will see something similar to Figure 4.10 in your browser.

Figure 4.10. Using ConstantLayout


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

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