Jul 19

接下来的例子演示了Flex中如何利用ProgressBar.labelPlacement属性,在一个进度条(progress)中指定标签位置。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:Label text="ProgressBar.labelPlacement" />
  8.     <mx:HBox>
  9.         <mx:VBox>
  10.             <mx:RadioButtonGroup id="rbg" />
  11.             <mx:RadioButton label="left" group="{rbg}" />
  12.             <mx:RadioButton label="center" group="{rbg}" />
  13.             <mx:RadioButton label="right" group="{rbg}" />
  14.             <mx:RadioButton label="top" group="{rbg}" />
  15.             <mx:RadioButton label="bottom" group="{rbg}" />
  16.         </mx:VBox>
  17.         <mx:VBox backgroundColor="white"
  18.                 horizontalAlign="center"
  19.                 verticalAlign="middle"
  20.                 width="200" height="100%">
  21.  
  22.             <mx:ProgressBar id="progressBar"
  23.                     barColor="haloOrange"
  24.                     label="{rbg.selectedValue}"
  25.                     labelPlacement="{rbg.selectedValue}"
  26.                     mode="manual"
  27.                     width="150"
  28.                     creationComplete="progressBar.setProgress(50, 100)" />
  29.  
  30.         </mx:VBox>
  31.     </mx:HBox>
  32.  
  33. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

written by Minidxer  |  tags: , ,

Leave a Reply