新聞中心
ComponentParent

我們提供的服務(wù)有:網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、鎮(zhèn)寧ssl等。為成百上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的鎮(zhèn)寧網(wǎng)站制作公司
public interface ComponentParent
定義父組件的特征。
此類為組件提供與其父組件交互的接口。
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| int | getChildIndex(Component component) | 查詢子組件的位置。 |
| ComponentParent | getComponentParent() | 獲取子組件的父組件。 |
| void | moveChildToFront(Component component) | 調(diào)整子組件的 z 順序,使其位于所有子組件之上。 |
| boolean | onDrag(Component component, DragEvent event) | 檢查拖動事件是否分發(fā)到父組件。 |
| void | postLayout() | 請求父組件重新排列其布局。 |
| void | removeComponent(Component component) | 從父組件中移除子組件。 |
| void | removeComponentAt(int index) | 從組件列表中的指定位置移除組件。 |
| void | removeComponents(int start, int count) | 從組件列表中的指定位置移除所有組件。 |
| ComponentContainer.LayoutConfig | verifyLayoutConfig(ComponentContainer.LayoutConfig config) | 根據(jù)當(dāng)前布局類型驗證布局參數(shù)。 |
方法詳情
postLayout
void postLayout()
請求父組件重新排列其布局。
getChildIndex
int getChildIndex(Component component)
查詢子組件的位置。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| component | 指示要查詢的子組件。 |
返回:
返回一個正整數(shù),表示子組件在父組件中的位置; 如果子組件不包含在父組件中,則返回 -1。
removeComponent
void removeComponent(Component component)
從父組件中移除子組件。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| component | 指示要移除的子組件。 |
removeComponentAt
void removeComponentAt(int index)
從組件列表中的指定位置移除組件。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| index | 指示要移除的組件的位置索引。 |
removeComponents
void removeComponents(int start, int count)
從組件列表中的指定位置移除所有組件。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| start | 表示第一個移除的組件的位置索引。 |
| count | 表示要移除的組件數(shù)量。 |
verifyLayoutConfig
ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig config)
根據(jù)當(dāng)前布局類型驗證布局參數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| config | 指示要轉(zhuǎn)換為 ComponentContainer 實例的一組布局參數(shù)。 |
返回:
返回 LayoutConfig 實例,它表示布局參數(shù)。
getComponentParent
ComponentParent getComponentParent()
獲取子組件的父組件。
返回:
返回子組件的父組件。
moveChildToFront
void moveChildToFront(Component component)
調(diào)整子組件的 z 順序,使其位于所有子組件之上。
z 順序調(diào)整會更改順序相關(guān)的布局。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| component | 指示要移動到所有子組件頂部的子組件。 |
onDrag
boolean onDrag(Component component, DragEvent event)
檢查拖動事件是否分發(fā)到父組件。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| component | 表示接收拖動事件的組件。 |
| event | 指示 DragEvent 對象。 |
返回:
如果拖動事件已經(jīng)被父組件處理,則返回 true; 否則返回 false。
網(wǎng)站標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSComponentParent
文章網(wǎng)址:http://m.fisionsoft.com.cn/article/dhdihhi.html


咨詢
建站咨詢
