新聞中心
ComponentTransition

java.lang.Object
|---ohos.agp.components.ComponentTransition
public class ComponentTransition
extends Object為 ComponentContainer 對象的布局更改提供動畫。
要在布局容器上執(zhí)行布局轉(zhuǎn)換,請創(chuàng)建一個 ComponentTransition 對象,然后使用 ComponentContainer#setComponentTransition 設(shè)置一個 ComponentContainer 對象。
字段摘要
| 修飾符和類型 | 字段 | 描述 |
|---|---|---|
| static int | CHANGING | 指示在由布局修改更改的組件上運行的動畫,而不是通過在布局容器中添加或刪除組件。 |
| static int | OTHERS_GONE | 指示在組件上運行的動畫,因為它們的關(guān)聯(lián)組件之一從 ComponentContainer 中消失而發(fā)生更改。 |
| static int | OTHERS_SHOW | 指示在組件上運行的動畫,因為它們的關(guān)聯(lián)組件之一出現(xiàn)在 ComponentContainer 中而發(fā)生更改。 |
| static int | SELF_GONE | 表示當(dāng)組件從 ComponentContainer 中消失時在組件上運行的動畫。 |
| static int | SELF_SHOW | 表示當(dāng)組件出現(xiàn)在 ComponentContainer 中時在組件上運行的動畫。 |
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| ComponentTransition() | 用于創(chuàng)建 ComponentTransition 實例的默認(rèn)構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| void | addTransitionType(int type) | 為 ComponentTransition 對象啟用過渡類型。 |
| AnimatorProperty | getAnimatorProperty(int type) | 獲取指定轉(zhuǎn)場類型的組件屬性動畫器。 |
| boolean | hasTransitionType(int type) | 檢查是否為 ComponentTransition 對象啟用了指定的過渡類型。 |
| void | release() | 釋放一個 ComponentTransition 對象。 |
| void | removeTransitionType(int type) | 從 ComponentTransition 對象中移除過渡類型。 |
| void | setAnimatorProperty(int type, AnimatorProperty animator) | 設(shè)置指定轉(zhuǎn)換類型的可自定義組件屬性動畫器。 |
| void | setTransitionTypeDuration(int type, int duration) | 設(shè)置指定過渡類型動畫的持續(xù)時間。 |
| 從類 java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段詳細信息
CHANGING
public static final int CHANGING
指示在由布局修改更改的組件上運行的動畫,而不是通過在布局容器中添加或刪除組件。
默認(rèn)情況下,此轉(zhuǎn)換類型被禁用。 您可以調(diào)用 addTransitionType(int) 來啟用它。
OTHERS_GONE
public static final int OTHERS_GONE
指示在組件上運行的動畫,因為它們的關(guān)聯(lián)組件之一從 ComponentContainer 中消失而發(fā)生更改。
OTHERS_SHOW
public static final int OTHERS_SHOW
指示在組件上運行的動畫,因為它們的關(guān)聯(lián)組件之一出現(xiàn)在 ComponentContainer 中而發(fā)生更改。
SELF_GONE
public static final int SELF_GONE
表示當(dāng)組件從 ComponentContainer 中消失時在組件上運行的動畫。
SELF_SHOW
public static final int SELF_SHOW
表示當(dāng)組件出現(xiàn)在 ComponentContainer 中時在組件上運行的動畫。
構(gòu)造函數(shù)詳細信息
ComponentTransition
public ComponentTransition()
用于創(chuàng)建 ComponentTransition 實例的默認(rèn)構(gòu)造函數(shù)。
方法詳情
release
public void release()
釋放一個 ComponentTransition 對象。
addTransitionType
public void addTransitionType(int type)
為 ComponentTransition 對象啟用過渡類型。
過渡類型包括 SELF_SHOW、OTHERS_SHOW、OTHERS_GONE、SELF_GONE 和 CHANGING。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 指示要啟用的轉(zhuǎn)換類型。 |
removeTransitionType
public void removeTransitionType(int type)
從 ComponentTransition 對象中移除過渡類型。
默認(rèn)情況下,啟用除 CHANGING 之外的所有轉(zhuǎn)換類型。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 指示要刪除的轉(zhuǎn)換類型。 |
hasTransitionType
public boolean hasTransitionType(int type)
檢查是否為 ComponentTransition 對象啟用了指定的過渡類型。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 表示指定的過渡類型。 |
返回:
如果添加了指定的過渡類型,則返回 true; 否則返回 false。
setTransitionTypeDuration
public void setTransitionTypeDuration(int type, int duration)
設(shè)置指定過渡類型動畫的持續(xù)時間。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 表示指定的轉(zhuǎn)場類型,可以是SELF_SHOW、OTHERS_SHOW、OTHERS_GONE、SELF_GONE或CHANGING。 |
| duration | 指示過渡動畫的持續(xù)時間,以毫秒為單位。 |
setAnimatorProperty
public void setAnimatorProperty(int type, AnimatorProperty animator)
設(shè)置指定轉(zhuǎn)換類型的可自定義組件屬性動畫器。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 表示指定的轉(zhuǎn)場類型,可以是SELF_SHOW、OTHERS_SHOW、OTHERS_GONE、SELF_GONE或CHANGING。 |
| animator | 表示組件屬性動畫器。 |
getAnimatorProperty
public AnimatorProperty getAnimatorProperty(int type)
獲取指定轉(zhuǎn)場類型的組件屬性動畫器。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 表示指定的轉(zhuǎn)場類型,可以是SELF_SHOW、OTHERS_SHOW、OTHERS_GONE、SELF_GONE或CHANGING。 |
返回:
返回指定轉(zhuǎn)場類型的AnimatorProperty對象; 否則返回 null。
分享名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSComponentTransition
網(wǎng)頁鏈接:http://www.dlmjj.cn/article/cdjsipi.html


咨詢
建站咨詢
