In fact, it is very easy to note that when viewstack is used and its height is set to 100%, multiple child container (A and B) are added to it ). What will happen to the viewstack height? This example can be used to apply different States from multiple components. For example, in some cases, I need to display the UI of A and in some places I need to display the UI of B, however, their height and width are different. If the height of A is greater than that of B, the following problem occurs when I want to display B, although I set the height of its application to be consistent with that of B, according to the general practice, because the height of viewstack is 100%, so how does the blank side appear if it is the same as the application height? In fact, when using viewstack, There is a note that when the viewstack height is set to 100%, the viewstack height will not be the same as the application height, its height is consistent with that of the highest child. In fact, this feature is very easy to find in a simple example, but suppose that many height values are set to 100% and contain multiple containers during project creation, it is very difficult to find out at this time. I would like to tell you a trick: if such a situation occurs, use different background colors to differentiate these containers, finally, we can see which container has a problem! In other words, this feature may already be known to many people, but I still want to point out here that I want to make a backup and let unknown friends know about it, avoid detours: Code (The code is modified based on componentexplorer .)
Copy code The Code is as follows: <? XML version = "1.0"?>
<! -- Simple example to demonstrate the viewstack layout container. -->
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" Height = "500" creationcomplete = "{myviewstack. selectedindex = 1}">
<! -- Define the viewstack and the three child containers and have it
Resize up to the size of the container for the buttons. -->
<Mx: viewstack id = "myviewstack" borderstyle = "solid" width = "100%" Height = "100%">
<Mx: canvas id = "Search" backgroundcolor = "# ffffcc" label = "Search" width = "100%" Height = "100">
<Mx: Label text = "search screen" color = "#000000" type = "regxph" text = "yourobjectname"/>
</MX: canvas>
<Mx: canvas id = "custinfo" backgroundcolor = "# ccffff" label = "Customer Info" width = "100%" Height = "200">
<Mx: Label text = "Customer Info" color = "#000000"/>
</MX: canvas>
<Mx: canvas id = "accountinfo" backgroundcolor = "# ffccff" label = "account info" width = "100%" Height = "300">
<Mx: Label text = "account info" color = "#000000"/>
</MX: canvas>
</MX: viewstack>
</MX: Application>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.