<Schlüsselattribut>
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Gibt Ansichtsattribute zu einem bestimmten Zeitpunkt während der Bewegungsabfolge an. Ich
kann mit <KeyAttribute>
die Standardattribute der Ansicht festlegen.
Angenommen, die Deckkraft einer Ansicht (android:alpha
) ist am Anfang auf 0 gesetzt
<ConstraintSet>
und 1 in den letzten <ConstraintSet>
. Standardmäßig wird dadurch
wird die Ansicht linear über die gesamte Bewegungsabfolge eingeblendet. Wenn Sie die Ansicht
für 80% der Bewegungsabfolge unsichtbar zu bleiben und dann schnell zu erscheinen,
einen <KeyAttribute>
-Knoten mit dem Attribut motion:framePosition
auf 80 und
Das Attribut android:alpha
muss auf 0 festgelegt sein.
Syntax
<KeyAttribute
motion:motionTarget="@id/targetPath"
motion:framePosition="percentage"
[ attribute = value ]
/>
Attribute
motion:motionTarget
- Ansicht, deren Attribute über
<KeyAttribute>
gesteuert werden.
motion:framePosition
- Ganzzahl zwischen 1 und 99, die angibt, wann in der Bewegungsabfolge die Ansicht das Element
Attribute, die in diesem
<KeyAttribute>
angegeben werden. Beispiel: framePosition
25 beträgt, dann hat die Ansicht ein Viertel der Strecke die angegebenen Attribute
durch die Bewegungsabfolge.
Sie können die folgenden Ansichtsattribute festlegen. Weitere Informationen zu diesen
finden Sie auf der Referenzseite zu View
.
android:alpha
android:elevation
android:rotation
android:rotationX
android:rotationY
android:scaleX
android:scaleY
android:translationX
android:translationY
android:translationZ
android:visibility
transitionPathRotate
Enthalten in
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-07-27 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-27 (UTC)."],[],[],null,["# <KeyAttribute>\n\nSpecifies view attributes at a specific moment during the motion sequence. You\ncan use `\u003cKeyAttribute\u003e` to set the view's [standard attributes](/reference/android/support/constraint/motion/MotionLayout#standard-attributes).\n\nSuppose a view's opacity (`android:alpha`) is set to 0 in the initial\n`\u003cConstraintSet\u003e` and 1 in the final `\u003cConstraintSet\u003e`. By default, this makes\nthe view linearly fade in for the entire motion sequence. If you want the view\nto remain invisible for 80% of the motion sequence and then fade in quickly, add\na `\u003cKeyAttribute\u003e` node with the `motion:framePosition` attribute set to 80 and\nthe `android:alpha` attribute set to 0.\n\nSyntax\n------\n\n```xml\n\u003cKeyAttribute\n motion:motionTarget=\"@id/targetPath\"\n motion:framePosition=\"percentage\"\n [ attribute = value ]\n/\u003e\n```\n\nAttributes\n----------\n\n`motion:motionTarget`\n: View whose attributes are controlled by this `\u003cKeyAttribute\u003e`.\n\n`motion:framePosition`\n: Integer from 1 to 99 specifying when in the motion sequence the view has the\n attributes specified by this `\u003cKeyAttribute\u003e`. For example, if `framePosition`\n is 25, then the view has the specified attributes one-quarter of the way\n through the motion sequence.\n\nYou can set the following view attributes. For more information about these\nattributes, see the [`View`](/reference/android/view/View) reference page.\n\n- `android:alpha`\n- `android:elevation`\n- `android:rotation`\n- `android:rotationX`\n- `android:rotationY`\n- `android:scaleX`\n- `android:scaleY`\n- `android:translationX`\n- `android:translationY`\n- `android:translationZ`\n- `android:visibility`\n- `transitionPathRotate`\n\nContained in\n------------\n\n- [`\u003cKeyFrameSet\u003e`](/training/constraint-layout/motionlayout/ref/keyframeset)"]]