הטמעת משוב מגע ב-Android
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מגע הוא כל מה שמרגישים באמצעות חוש המגע. מכשירי Android מודרניים כוללים בדרך כלל מנגנון רטט שמאפשר למכשירים לעורר את חוש המגע של המשתמשים. המנועים האלה התקדמו מאוד מהרטט החזק והרועם המקורי שהמכשירים הראשונים סיפקו, ועכשיו אפליקציות ל-Android יכולות לנצל את היכולות שלהם כדי לספק למשתמשים חוויה עשירה יותר עם עומק וניואנסים.
בדפים הבאים מוסבר כל מה שצריך לדעת על רטט, החל ממשוב הפיזי הבסיסי ועד לצורות גל של רטט והרכבים של אפקטים מורכבים יותר ויותר.
- עקרונות עיצוב של משוב מישוש
- בדף מוסבר אילו סיווגים נתמכים על ידי המשוב החושי של Android, ויש בו הנחיות לתכנון שלהם.
- הוספת משוב פיזי לאירועים
- בדף מוצגות דוגמאות לקוד שמציגות דרכים שונות לספק משוב לחושי לאינטראקציות של משתמשים.
- מבוא לתנודות
- בדף הזה מופיעה סקירה כללית של אופן הפעולה של מפעילי רטט, שהיא ידע מוקדם חשוב ליצירת תחושות מגע בהתאמה אישית.
- יצירת אפקטים של משוב מישוש בהתאמה אישית
- בדף הזה מפורטות כמה דוגמאות לשימוש בממשקי API שונים של משוב מגע כדי ליצור אפקטים מותאמים אישית באפליקציה ל-Android.
- הוספת ממשקי API של משוב מגע
- הדף הזה הוא מסמך עזרה לגבי ממשקי API שונים של משוב מגע שזמינים ב-Android, וגם מוסבר בו מתי ואיך לבדוק את התמיכה במכשיר הנדרשת כדי לוודא שהאפקטים של המשוב המגע פועלים כמצופה.
מומלץ גם לקרוא את השיטות המומלצות לשיפור הנגישות.
דוגמיות
הדוגמאות הבאות זמינות באפליקציית Haptic Sampler ב-GitHub. כאן אפשר למצוא גם את המסמכים של כל אחד מהם.
המסמך הזה כולל גם דוגמאות קוד לדפוסי הרטט בהתאמה אישית הבאים:
וידאו
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון 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-26 (שעון UTC)."],[],[],null,["# Implement haptics on Android\n\nHaptics is everything you feel through the sense of touch. Modern Android\ndevices often incorporate a vibration actuator to allow devices to stimulate the\nuser's sense of touch. These motors have advanced significantly from the\noriginal loud buzzy vibration produced by early devices, and Android apps can\nnow take advantage of capabilities to give users a richer experience with\nsubtlety and depth.\n\nThe following pages cover everything about vibration, from basic haptic feedback\nto increasingly more complex vibration waveforms and effect compositions.\n\n[Haptics design principles](/develop/ui/views/haptics/haptics-principles)\n: The page describes the classifications supported by Android haptics and\n guidelines for designing them.\n\n[Add haptic feedback to events](/develop/ui/views/haptics/haptic-feedback)\n: The page presents code examples for different ways of providing haptic\n feedback to user interactions.\n\n[Vibration actuators primer](/develop/ui/views/haptics/actuators)\n: The page provides an overview of how vibration actuators work, which is\n important prerequisite knowledge for creating custom haptics.\n\n[Create custom haptic effects](/develop/ui/views/haptics/custom-haptic-effects)\n: This page provides several examples of using different haptics APIs to\n create custom effects in an Android application.\n\n[Add haptics APIs](/develop/ui/views/haptics/haptics-apis)\n: The page is a reference for various haptics APIs available on Android, and\n also covers when and how to check for any device support necessary to ensure\n your Haptic effects play as intended.\n\nAlso, be sure to read the\n[best practices for accessibility](/guide/topics/ui/accessibility).\n\nSamples\n-------\n\nThe following samples are available in the [Haptic Sampler app](https://github.com/android/platform-samples/tree/main/samples/user-interface/haptics) on\nGitHub. You can also find documentation for each here.\n\n- [Resist (with low ticks)](/develop/ui/views/haptics/custom-haptic-effects#resist)\n- [Expand (with rise and fall)](/develop/ui/views/haptics/custom-haptic-effects#expand)\n- [Wobble (with spins)](/develop/ui/views/haptics/custom-haptic-effects#wobble)\n- [Bounce (with thuds)](/develop/ui/views/haptics/custom-haptic-effects#bounce)\n\nThis documentation also includes code examples for the following custom vibration patterns:\n\n- [Ramp-up pattern](/develop/ui/views/haptics/custom-haptic-effects#ramp_up_pattern)\n- [Repeating pattern](/develop/ui/views/haptics/custom-haptic-effects#repeating_pattern)\n- [Pattern with fallback](/develop/ui/views/haptics/custom-haptic-effects#pattern_with_fallback)\n\nVideo\n-----"]]