VirtualView屬性
$ 屬性引用, 如 KaTeX parse error: Expected '}', got 'EOF' at end of input: …
@ 三元條件表達式,如 @{{logoUrl} ? visible : invisible } 若logoUrl屬性的值存在,則取visible,否則invisible。
@{${titleColor} ? ${titleColor} : black } ,若titleColor的值存在,則直接用,否則用black。
一,公共屬性
id int 0 組件id
layoutWidth int/float/enum(match_parent/wrap_content)
layoutHeight int/float/enum(match_parent/wrap_content)
layoutGravity enum(left/right/top/bottom/v_center/h_center) left|top
autoDimX int/float 1 組件寬高比計算的橫向值
autoDimY int/float 1 組件寬高比計算的豎向值
autoDimDirection enum(X/Y/NONE) 組件在佈局中的基準方向,用於計算組件的寬高比,與autoDimX、autoDimY配合使用,設置了這三個屬性時,在計算組件尺寸時具有更高的優先級。當autoDimDirection=X時,組件的寬度由layoutWidth和父容器決策決定,但高度 = width * (autoDimY / autoDimX),當autoDimDirection=Y時,組件的高度由layoutHeight和父容器決策決定,但寬度 = height * (autoDimX / autoDimY)
minWidth(iOS暫未支持) int/float 0 最小寬度
minHeight(iOS暫未支持) int/float 0 最小高度
padding int/float 0 同時設置 4 個內邊距
paddingLeft int/float 0 左內邊距,優先級高於 padding
paddingRight int/float 0 右內邊距,優先級高於 padding
paddingTop int/float 0 上內邊距,優先級高於 padding
paddingBottom int/float 0 下內邊距,優先級高於 padding
layoutMargin int/float 0 同時設置 4 個外邊距
layoutMarginLeft int/float 0 左外邊距,優先級高於 layoutMargin
layoutMarginRight int/float 0 右外邊距,優先級高於 layoutMargin
layoutMarginTop int/float 0 上外邊距,優先級高於 layoutMargin
layoutMarginBottom int/float 0 下外邊距,優先級高於 layoutMargin
background int 0 背景色
borderWidth int/float 0 邊框寬度
borderColor int 0 邊框顏色
borderRadius int/float 0 邊框四個角的圓角半徑,與 borderWidth 配合使用,支持NText、VText、VHLayout、VH2Layout、FrameLayout、GridLayout
borderTopLeftRadius int/float 0 單獨設置左上角圓角半徑,使用同上(iOS僅Layout支持單獨設置),優先級高於 borderRadius
borderTopRightRadius int/float 0 單獨設置右上角圓角半徑,使用同上(iOS僅Layout支持單獨設置),優先級高於 borderRadius
borderBottomLeftRadius int/float 0 單獨設置左下角圓角半徑,使用同上(iOS僅Layout支持單獨設置),優先級高於 borderRadius
borderBottomRightRadius int/float 0 單獨設置右下角圓角半徑,使用同上(iOS僅Layout支持單獨設置),優先級高於 borderRadius
visibility enum(visible/invisible/gone) visible 可見性,與Android裏的概念類似,visible:可見,invisible:不可見,但佔位,gone:不可見也不佔位
dataTag string 組件數據標識
flag enum(flag_software/flag_exposure/flag_clickable/flag_longclickable/flag_touchable) 組件行爲定義 flag_software:關閉view的硬件加速,flag_exposure:需要觸發曝光事件,flag_clickable:需要響應點擊事件,flag_longclickable:需要響應長按事件,flag_touchable:需要響應觸摸事件
action string null (表示點擊事件觸發之後跳轉到數據中action字段定義的頁面)
class string null 跟組件綁定的邏輯處理對象名稱
數值單位
在組件屬性裏,跟尺寸相關的屬性,其值的單位默認是dp,比如layoutWidth=10,表示寬度是10dp;實際值 = dp * density;
爲了更精準地適配視覺,支持rp單位,表示適配屏幕大小的值,比如layoutWidth=10rp,實際值 = 10 * 屏幕寬度 / 750;
顏色值
在組件顏色相關屬性裏,支持16進制數表示,#RRGGBB、#AARRGGBB,也支持以下幾個顏色文本:
black blue cyan dkgray gray green ltgray magenta red transparent yellow