The Android Developer Challenge is back! Submit your idea before December 2.

<KeyAttribute>

Specifies view attributes at a specific moment during the motion sequence. You can use <KeyAttribute> to set any of the view's standard attributes.

For example, suppose a view's opacity (android:alpha) is set to 0 in the initial <ConstraintSet> and 1 in the final <ConstraintSet>. By default, this would cause the view to linearly fade in over the entire motion sequence. If, instead, you want that view to remain invisible until 80% of the way through the motion sequence and then fade in quickly, you would do this by adding a single <KeyAttribute> node, with motion:framePosition set to 80 and android:alpha set to 0.

Syntax

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

Attributes

motion:motionTarget
View whose attributes are controlled by this <KeyAttribute>.
motion:framePosition
Integer from 1 to 99 specifying when in the motion sequence the view has the attributes specified by this <KeyAttribute>. For example, if framePosition is 25, the view has the specified attributes a fourth of the way through the motion.

You can set the following view attributes. For more information on these attributes, see the View reference documentation.

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

Contained in