<KeyAttribute>

指定動作序列中特定時間點的檢視畫面屬性。您可以使用 <KeyAttribute> 來設定檢視畫面的標準屬性

假設檢視畫面的不透明度 (android:alpha) 在初始 <ConstraintSet> 中設為 0,在最終 <ConstraintSet> 中則設為 1。根據預設,這會讓檢視畫面在整個動作序列中呈現線性淡出。如果希望檢視畫面在 80% 的動作序列中保持隱藏,然後快速淡出,請新增 <KeyAttribute> 節點,並將 motion:framePosition 屬性設為 80,並將 android:alpha 屬性設為 0。

語法

<KeyAttribute
  motion:motionTarget="@id/targetPath"
  motion:framePosition="percentage"
  [ attribute = value ]
/>

屬性

motion:motionTarget
查看哪些屬性是由這個 <KeyAttribute> 控制。
motion:framePosition
介於 1 到 99 之間的整數,表示檢視畫面在動態序列中具有此 <KeyAttribute> 指定的屬性。舉例來說,如果 framePosition 為 25,則檢視畫面具有指定屬性的四分之一通過動作序列指定的屬性。

您可以設定下列檢視屬性。如要進一步瞭解這些屬性,請參閱 View 參考頁面。

  • android:alpha
  • android:elevation
  • android:rotation
  • android:rotationX
  • android:rotationY
  • android:scaleX
  • android:scaleY
  • android:translationX
  • android:translationY
  • android:translationZ
  • android:visibility
  • transitionPathRotate

包含於