如何设置LinkBar选中时的样式
请教一下如何设置LinkBar选中时的样式,不然无法确定是选择哪个按钮, 查了很久没有发现。。。
[解决办法]
解决了,你只需在样式设置的地方设置你要的效果就是了,你如果不清楚哪些属性的是代表什么,你可以一个区试一试就清楚了,另外你可以在CSDN去下载我平时项目中所积累的组件样式设置,对你很有帮助的,你可以下载参考,你在CSDN中搜索:“flex学习礼记”就可以找到,记得结贴给分哦,你这个样式例子如下:
<?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">
<s:layout>
<s:HorizontalLayout verticalAlign="middle"
horizontalAlign="center"/>
</s:layout>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
mx
[解决办法]
LinkBar{
borderStyle: none;
backgroundAlpha: 1;
separatorColor: #000000;
rollOverColor: #ff6699;
color: #ffff33;
textRollOverColor: #9999ff;
disabledColor: #ffcccc;
fontWeight: normal;
}
</fx:Style>
<s:Panel title="LinkBar Control"
width="600"
height="100%"
color="0x000000"
borderAlpha="0.15">
<s:layout>
<s:VerticalLayout paddingLeft="10"
paddingRight="10"
paddingTop="10"
paddingBottom="10"/>
</s:layout>
<s:Label width="100%"
color="0x323232"
textAlign="center"
text="Select a link in the LinkBar control to set the active child of the ViewStack container."/>
<mx:LinkBar color="0x0050AA"
horizontalAlign="center"
width="100%"
fontWeight="bold"
dataProvider="{myViewStack}"
borderColor="0xACACAC"
borderStyle="solid"/>
<!-- Define the ViewStack and the three child containers -->
<mx:ViewStack id="myViewStack"
borderStyle="solid"
width="100%"
height="80%"
color="0x323232">
<s:NavigatorContent id="search"
label="Customer Info"
backgroundColor="0xDCDCDC"
fontWeight="bold">
<s:layout>
<s:VerticalLayout horizontalAlign="center"/>
</s:layout>
<s:Label text="Search Panel"
width="100%"
textAlign="center"
paddingTop="10"/>
<s:HGroup>
<s:TextInput id="Searchtxt"
width="200"/>
<s:Button label="search"
click="Searchtxt.text=''"/>
</s:HGroup>
</s:NavigatorContent>
<s:NavigatorContent id="custInfo"
label="Customer Info"
backgroundColor="0xDCDCDC"
width="100%"
height="100%">
<s:layout>
<s:VerticalLayout horizontalAlign="center"/>
</s:layout>
<s:Label text="Customer Info"
width="100%"
textAlign="center"
paddingTop="10"/>
<s:HGroup>
<s:Label text="Email Address"/>
<s:TextInput id="email"
width="200"/>
<s:Button label="Submit"
click="email.text='';"/>
</s:HGroup>
</s:NavigatorContent>
<s:NavigatorContent id="accountInfo"
label="Account Info"
backgroundColor="0xDCDCDC"
width="100%"
height="100%"
fontWeight="bold">
<s:layout>
<s:VerticalLayout horizontalAlign="center"/>
</s:layout>
<s:Label text="Account Info"
width="100%"
textAlign="center"
paddingTop="10"/>
<s:HGroup>
<mx:Button label="Purchases"/>
<mx:Button label="Sales"/>
<mx:Button label="Reports"/>
</s:HGroup>
</s:NavigatorContent>
</mx:ViewStack>
</s:Panel>
</s:Application>
LinkBar {
borderStyle: none;
backgroundAlpha: 1;
separatorColor: #000000;
rollOverColor: #ff6699;
selectionColor: #ff6600;
color: #ffff33;
textRollOverColor: #9999ff;
disabledColor: #ffcccc;
fontWeight: normal;
dropShadowEnabled: false;
shadowDirection: left;
}