<KeyAttribute>
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מציינת את מאפייני הצפייה ברגע מסוים ברצף התנועה. שלך
יכול להשתמש ב-<KeyAttribute>
כדי להגדיר את המאפיינים הרגילים של התצוגה.
נניח שמידת האטימות (android:alpha
) של תצוגה מוגדרת ל-0 בשדה הראשוני
<ConstraintSet>
ו-1 ב-<ConstraintSet>
הגמר. כברירת מחדל,
את התצוגה להפוך לשקוף בהדרגה לאורך כל רצף התנועה. אם אתם רוצים לצפות בתצוגה
כך שיישאר בלתי נראה במשך 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
בתוך
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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)"]]