div

API

Attributes

NameDescriptionTypeDefault
focusable是否可以获得焦点booleanfalse
clipChildren裁剪子布局booleanfalse
clipPadding从padding区域向外裁剪booleanfalse
enableFocusBorder是否显示焦点框booleanfalse
focusScale焦点放大倍数number1.1
duplicateParentState继承父类的状态booleanfalse
showOnState在指定状态显示enumnormal
backgroundColorStr 2.87以字符串形式指定的背景色string-
nextFocusDownSID 2.7向下时指定下一个焦点sidstring-
nextFocusUpSID 2.7向上时指定下一个焦点sidstring-
nextFocusLeftSID 2.7向左时指定下一个焦点sidstring-
nextFocusRightSID 2.7向右时指定下一个焦点sidstring-
nextFocusSID 2.7指定各方向下一个焦点sidobject-
sid 2.7给一个元素标记一个string id,可随意赋值,需确保唯一string-
scrollOverride 2.7parentqt-list等列表时,可以覆写各方向获焦时滚动的值object-
skipRequestFocus 2.7忽略组件内自动寻焦(例如聚焦元素丢焦时)booleanfalse
fadingEdgeLength 2.5淡出效果长度number0
horizontalFadingEdgeEnabled 2.5开启横向淡出效果booleanfalse
verticalFadingEdgeEnabled 2.5开启纵向淡出效果booleanfalse
autofocus 2.7组件内根据状态(初始化、可见性改变、尺寸改变)变化自动获焦,focusable为true时自己获焦booleanfalse
renderToHardwareTextureAndroid设置layerTypeLAYER_TYPE_HARDWAREbooleanfalse
viewLayerType设置layerTypeenum-
clipBounds设置裁剪区域object-
descendantFocusability设置子孙组件的可聚焦性策略enum-
name指定元素的namestring-
nextFocusName指定各方向下一个焦点元素的nameobject-
bringFocusChildToFront是否自动将获焦元素绘制在顶层booleanfalse
dispatchChildFocusEvent发送子元素焦点事件booleanfalse
selected选择状态booleanfalse
visible是否可见booleanfalse
visibility可见性enumvisible
size virtual dom组件中使用设置元素大小array-
layout virtual dom组件中使用设置元素位置及大小array-
showDialog 2.87以dialog形式展示或隐藏,焦点会自动保存、恢复boolean-
interceptAllKeys阻止元素内所有key事件booleanfalse
enableOverScrollY 2.87开启获焦时纵向自动滚动booleanfalse
enableOverScrollX 2.87开启获焦时横向自动滚动booleanfalse
selectChildPosition 2.87设置选中子元素位置number-1
enableSelectOnFocus 2.87开启当焦点时自动设置选中子元素位置number-1
focusMemory开启子元素焦点记忆booleanfalse
gradientBackground设置渐变背景色objectfalse
listenHasFocusChange开启hasFocus事件监听booleanfalse
shakeSelf开启焦点终止时抖动booleanfalse

Events

NameDescriptionType
layout当元素挂载或者布局改变的时候调用。Function
focus焦点变化事件Function
click点击事件Function
select选择事件Function
interceptKeyEvent使用interceptAllKeys时回调Function
childFocus子元素焦点变化时回调Function

Exposes

MethodDescriptionType
requestFocus请求焦点Function
requestChildFocus请求孩子焦点Function
clearFocus清除焦点Function
requestFocusDirectly直接请求焦点Function
setVisibility设置是否可见Function
requestRootLayout请求根节点重新布局Function
requestLayout请求重新布局Function
setDescendantFocusability改变子元素获焦策略Function
changeDescendantFocusability改变子元素获焦策略Function
forceUpdateRenderNode强制刷新渲染节点Function
setBackGroundColor设置背景色Function
layoutViewManual手动布局界面Function
blockRootFocus阻塞焦点Function
unBlockRootFocus取消阻塞焦点Function
changeAlpha设置alphaFunction
setScale设置形变Function
setPosition设置位置Function
updateLayout改变布局Function
invalidate刷新布局Function
dispatchFunctionForTarget调用目标的方法Function
setBlockFocusDirections设置阻塞焦点的方向Function
setBlockFocusDirectionsOnFail失败的时候设置阻塞焦点的方向Function
setInitFocus设置初始焦点Function
setAutoFocus设置自动焦点Function
enabledAutofocus设置自动焦点是否可用Function
requestAutofocus请求自动焦点Function
hasFocus是否有焦点Function
isFocused是否获得了焦点Function
getLocationOnScreen获取在屏幕上的位置Function
getViewState获取视图的状态Function
getChildViewState获取孩子视图的状态Function
changeVisibility设置可见性Function
requestChildFocusAtIndex请求index值子元素焦点Function
clearMemoryFocused清除记忆的焦点Function

Source

Docs