Flex Label控件

2018-01-01 18:31 更新

介紹

Label是一個(gè)UIComponent,可以渲染一行或多行統(tǒng)一格式的文本。 要顯示的文本由繼承自TextBase控件的text屬性確定。

類聲明

以下是 spark.components.Label 類的聲明:

public class Label 
   extends TextBase

公共方法

S.N.方法和描述
1Label()
Constructor.

繼承的方法

此類繼承以下類中的方法:

  • mx.core.TextBase

  • mx.core.UIComponent

  • mx.core.FlexSprite

  • flash.display.Sprite

  • flash.display.DisplayObjectContainer

  • flash.display.InteractiveObject

  • flash.display.DisplayObject

  • flash.events.EventDispatcher

  • Object

Flex標(biāo)簽控件示例

讓我們按照以下步驟通過創(chuàng)建測(cè)試應(yīng)用程序來檢查Flex應(yīng)用程序中Label控件的使用:

步驟描述
1 Flex - 創(chuàng)建應(yīng)用程序章節(jié)中所述,在包 com.tutorialspoint.client 下創(chuàng)建名為 HelloWorld 的項(xiàng)目。
2修改 HelloWorld.mxml ,如下所述。 保持文件的其余部分不變。
3編譯并運(yùn)行應(yīng)用程序,以確保業(yè)務(wù)邏輯按照要求工作。

以下是修改后的mxml文件 src / com.tutorialspoint / HelloWorld.mxml 的內(nèi)容。

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   width="100%" height="100%" minWidth="500" minHeight="500" >	
   <fx:Style source="/com/tutorialspoint/client/Style.css"/>
   <s:BorderContainer width="550" height="500" id="mainContainer" 
   styleName="container">
      <s:VGroup width="100%" height="100%" gap="50" horizontalAlign="center"
      verticalAlign="middle">
         <s:Label id="lblHeader" text="Basic Controls Demonstration" 
         fontSize="40" color="0x777777" styleName="heading"/>
         <s:Panel title="Using Label" width="420" height="100" >
            <s:layout>
               <s:VerticalLayout paddingTop="10" paddingLeft="10"/>
            </s:layout>				
            <s:Label text = "This is a label"  paddingTop="6" />
            <s:Label text = "This is a highligted label." 
            fontWeight="bold" backgroundColor="0xFFF200" paddingTop="6"/>
         </s:Panel>		
      </s:VGroup>	 
   </s:BorderContainer>	
</s:Application>

準(zhǔn)備好所有更改后,讓我們以正常模式編譯和運(yùn)行應(yīng)用程序,就像在 Flex - 創(chuàng)建應(yīng)用程序中一樣 章節(jié)。 如果一切順利,您的應(yīng)用程序,這將產(chǎn)生以下結(jié)果:[在線試用]

Flex Label Control
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)