-
Notifications
You must be signed in to change notification settings - Fork 257
View Attributes
zhenglibao edited this page Jan 12, 2021
·
17 revisions
All subclass automatically own all the attributes of parent class.
If the following attributes are not enough, you can extend it with FLEXSET macro.
- string value: the value can be one string. If the string contains comma, you should use \, to prevent mess up, it also support \r(return) \n(newline) \t(table). '\' will be ''. Any other \c will be c.
- color value: the value can be color, the color be like #rrggbb or #aarrggbb, or the system predefined color (black/white/clear/darkGray/lightGray/gray/red/green/blue/cyan/yellow/magenta/orange/purple/brown), or an image (image must include dot, like img.png)
- number value: the value must be number
- number group value: the value should be like n1/n2/...
- boolean value: the value must be true or false
- enumeration value: the value should be one of the list
- @ is special attribute, the value should be filename/stylename. It can be used to reference style in other style file.
- bgColor: color
- borderWidth: number
- borderColor: color
- borderRadius: number
- shadowOffset: number group (2)
- shadowRadius: number
- shadowColor: color
- contentMode: enumeration -- scaleToFill / scaleAspectFit / scaleAspectFill / redraw / center / top / bottom / left / right / topLeft / topRight / bottomLeft / bottomRight
- alpha: number
- tag: number
- hidden: boolean
- clipsToBounds: boolean
- masksToBounds: boolean
- tintColor: color
新增:
- shadowOpacity: number
- layerBounds: number group (4)
- layerPosition: number group (2)
- layerZPosition: number
- layerAnchorPoint: number group (2)
- layerAnchorPointZ: number
- layerFrame: number group (4)
- layerHidden: boolean
- layerDoubleSided: boolean
- layerGeometryFlipped: boolean
- layerMasksToBounds: boolean
- layerContentsRect: number group (4)
- layerContentsGravity: string
- layerContentsScale: number
- layerContentsCenter: number group (4)
- layerContentsFormat: string
- layerMinificationFilter: string
- layerMagnificationFiltery: string
- layerMinificationFilterBias: number
- layerOpaque: boolean
- layerNeedsDisplayOnBoundsChange:boolean
- layerDrawsAsynchronously: boolean
- layerAllowsEdgeAntialiasing: boolean
- layerBackgroundColor: color
- layerCornerRadius: number
- layerOpacity: number
- allowsGroupOpacity: boolean
- shouldRasterize: boolean
- rasterizationScale: number
- layerName: string
- userInteractionEnabled:boolean
- contentScaleFactor: number
- multipleTouchEnabled: boolean
- exclusiveTouch: boolean
- autoresizesSubviews: boolean
- opaque: boolean
- clearsContextBeforeDrawing: boolean
//1.8.2增加font
- font: fontname|number (fontname也可以是bold或者italic),想使用该属性的类必须实现setFont:方法
- underlayColor: color
- activeOpacity: number (0~1)
- horzScroll: boolean
- vertScroll: boolean
//1.8.2增加
- placeholder: string
- placeholderColor: color
- text: string
- fontSize: number
- lineBreakMode: enumeration -- wordWrapping / charWrapping / clipping / truncatingHead / truncatingTail / truncatingMiddle
- linesNum: number
- color: color
- shadowColor: color
- highlightTextColor: color
- textAlign: enumeration -- left / center / right / justified / natural
- interactEnable: boolean
- adjustFontSize: boolean
//1.8.2增加
- lineSpacing: number
- paragraphSpacing: number
- firstLineHeadIndent: number
- headIndent: number
- tailIndent: number
//2.1.0增加Text和Image两种子元素,用来支持富文本,可以设置的属性包括:name, onPress, attr
- Text的属性包括:
text: string
font: fontname|fontsize
fontSize: number
color: color
bgColor: color
strike: enumeration -- none, single
underline: enumeration -- none, single
kern: number
- Image的属性包括:
source: string
bounds: x/y/w/h
size: w/h
- enabled: boolean
- selected: boolean
- highlighted: boolean
- vertAlignment: enumeration -- center / top / bottom / fill
- horzAlignment: enumeration -- center / left / right / fill / ( leading / trailing: only ios11)
- title: string
- color: color
- source: string
- highlightSource: string
- interactEnable: boolean
- horzIndicator: boolean
- vertIndicator: boolean
- pageEnabled: boolean
- scrollEnabled: boolean
- bounces: boolean
- alwaysBounceVertical: boolean // from 1.9.3
- alwaysBounceHorizontal: boolean // from 1.9.3
- indicatorStyle: enumeration -- default / black /white
- text: string
- placeholder: string
- fontSize: number
- color: color
- textAlign: enumeration -- left / center / right / justified /natural
- boderStyle: enumeration -- none / line / bezel /roundRect
- interactEnable: boolean
- adjustFontSize: boolean
- autocapitalizationType: enumeration -- none/words/sentences/allCharacters
- autocorrectionType: enumeration -- default/no/yes
- spellCheckingType: enumeration -- default/no/yes
- secureTextEntry: boolean
- keyboardType: enumeration -- default/asciiCapable/numberAndPunct/url/numberPad/phonePad/namePhonePad/emailAddress/decimalPad/twitter/webSearch/asciiCapableNumberPad
- keyboardAppearance: enumeration -- default/dark/light/alert
- returnKeyType: enumeration -- default/go/google/join/next/route/search/send/yahoo/done/emergencyCall/continue
- clearButtonMode: enumeration -- never/whileEditing/unlessEditing/always
- enablesReturnKeyAutomatically: boolean
- leftViewMode: enumeration -- never/whileEditing/unlessEditing/always
- leftViewMode: enumeration -- never/whileEditing/unlessEditing/always
- text: string
- fontSize: number
- color: color
- textAlign: enumeration -- left / center / right / justified /natural
- editable: boolean
- selectable: boolean
- autocapitalizationType: enumeration -- none/words/sentences/allCharacters
- autocorrectionType: enumeration -- default/no/yes
- spellCheckingType: enumeration -- default/no/yes
- secureTextEntry: boolean
- keyboardType: enumeration -- default/asciiCapable/numberAndPunct/url/numberPad/phonePad/namePhonePad/emailAddress/decimalPad/twitter/webSearch/asciiCapableNumberPad
- keyboardAppearance: enumeration -- default/dark/light/alert
- returnKeyType: enumeration -- default/go/google/join/next/route/search/send/yahoo/done/emergencyCall/continue
- enablesReturnKeyAutomatically: boolean
- style: enumeration -- whiteLarge / white /gray
- color: color
- pickerMode: enumeration -- time / date / dateTime / countDownTimer
- numberOfPages: number
- currentPage: number
- hidesForSinglePage: boolean
- pageTintColor: color
- curPageTintColor: color
- showSelIndicator: boolean
- style: enumeration -- default / bar
- progress: number
- progressTintColor: color
- trackTintColor: color
- barStyle: enumeration -- default / black / opaque
- text: string
- prompt: string
- placeholder: string
- bookMarkBtn: boolean
- cancelBtn: boolean
- resultBtn: boolean
- resultBtnSelected: boolean
- selectedIndex: number
- tintColor: color
- value: number
- minValue: number
- maxValue: number
- continuous: boolean
- minTintColor: color
- maxTintColor: color
- thumbTintColor: color
- value: number
- minValue: number
- maxValue: number
- stepValue: number
- continuous: boolean
- autorepeat: boolean
- wraps: boolean
- tintColor: color
- tintColor: color
- onTintColor: color
- on: boolean
- tintColor: color
- barTintColor: color
- unSelTintColor: color
- itemPosition: enumeration -- auto / fill / center
- itemSpacing: number
- itemWidth: number
- barStyle: enumeration -- default / black /opaque /translucent
- translucent: boolean
- barStyle: enumeration -- default / black /opaque /translucent
- translucent: boolean
- tintColor: color
- barTintColor: color
Flexbox Introduction & performance (in Chinese)
Tutorial 1: Create View Controller with xml layout
Tutorial 2: Create Table Cell with xml layout
Tutorial 3: Embed xml layout into traditional view hierarchy
Tutorial 4: Use custom view in xml layout
Tutorial 5: Create reusable view using xml layout file