סקירה כללית על סוגי המשאבים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בכל דף בקטע הזה מתוארים השימוש, הפורמט והתחביר של סוג מסוים של משאב אפליקציה שאפשר לספק בספריית המשאבים של הפרויקט (res/
).
הנה סיכום קצר של כל דף:
- מקורות מידע בנושא אנימציה
- הגדרת אנימציות מוגדרות מראש.
אנימציות Tween נשמרות ב-res/anim/
, והגישה אליהן מתבצעת מהקלאס R.anim
.
אנימציות של פריימים נשמרות ב-res/drawable/
, והגישה אליהן מתבצעת מהקלאס R.drawable
.
- משאב של רשימת מצבי צבע
- הגדרת משאב צבע שמשתנה בהתאם למצב
View
.
הפריט נשמר ב-res/color/
והגישה אליו מתבצעת מהכיתה R.color
.
- משאבים גרפיים שניתן להזזה
- הגדרת גרפיקה שונה באמצעות קובצי bitmap או XML.
הפריט נשמר ב-res/drawable/
והגישה אליו מתבצעת מהכיתה R.drawable
.
- משאב פריסה
- מגדירים את הפריסה של ממשק המשתמש של האפליקציה.
הפריט נשמר ב-res/layout/
והגישה אליו מתבצעת מהכיתה R.layout
.
- משאב תפריט
- הגדרת התוכן של תפריטי האפליקציה.
הפריט נשמר ב-res/menu/
והגישה אליו מתבצעת מהכיתה R.menu
.
- משאבי מחרוזות
- הגדרת מחרוזות, מערכים של מחרוזות וצורות רבות, וגם עיצוב וסגנון של מחרוזות.
נשמר ב-res/values/
וניתן לגשת אליו מהכיתות R.string
, R.array
ו-R.plurals
.
- משאב סגנון
- הגדרת המראה והפורמט של רכיבי ממשק המשתמש.
הפריט נשמר ב-res/values/
והגישה אליו מתבצעת מהכיתה R.style
.
- משאבי גופנים
- הגדרת משפחות גופנים וכלל גופנים בהתאמה אישית ב-XML.
הפריט נשמר ב-res/font/
והגישה אליו מתבצעת מהכיתה R.font
.
- סוגי משאבים נוספים
- הגדרת ערכים פרימיטיביים אחרים כמשאבים סטטיים, כולל:
- Bool
- משאב XML שמכיל ערך בוליאני.
- צבע
משאב - XML שנושא ערך צבע הקסדצימלי.
- מאפיין
משאב XML שמכיל ערך של מאפיין עם יחידת מידה.
- מזהה
משאב XML מסוג - שמספק מזהה ייחודי למשאבים ולרכיבים של האפליקציה.
- מספר שלם
- משאב XML שמכיל ערך שלם.
- מערך של מספרים שלמים
משאב XML מסוג - שמספק מערך של מספרים שלמים.
- מערך מוקלט
משאב XML מסוג - שמספק
TypedArray
, שאפשר להשתמש בו למערך של פריטים גרפיים שניתן להזזה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Resource types overview\n\nEach page in this section describes the usage, format, and syntax for a certain type\nof [app resource](/guide/topics/resources/providing-resources)\nthat you can provide in your project resources directory (`res/`).\n\nHere's a brief summary of each page:\n\n[Animation resources](/guide/topics/resources/animation-resource)\n: Define pre-determined animations. \n\n Tween animations are saved in `res/anim/` and accessed from the `R.anim` class. \n\n Frame animations are saved in `res/drawable/` and accessed from the `R.drawable` class.\n\n[Color state list resource](/guide/topics/resources/color-list-resource)\n: Define a color resource that changes based on the `View` state. \n\n Saved in `res/color/` and accessed from the `R.color` class.\n\n[Drawable resources](/guide/topics/resources/drawable-resource)\n: Define various graphics with bitmaps or XML. \n\n Saved in `res/drawable/` and accessed from the `R.drawable` class.\n\n[Layout resource](/guide/topics/resources/layout-resource)\n: Define the layout for your application UI. \n\n Saved in `res/layout/` and accessed from the `R.layout` class.\n\n[Menu resource](/guide/topics/resources/menu-resource)\n: Define the contents of your application menus. \n\n Saved in `res/menu/` and accessed from the `R.menu` class.\n\n[String resources](/guide/topics/resources/string-resource)\n: Define strings, string arrays, and plurals and include string formatting and styling. \n\n Saved in `res/values/` and accessed from the `R.string`, `R.array`,\n and `R.plurals` classes.\n\n[Style resource](/guide/topics/resources/style-resource)\n: Define the look and format for UI elements. \n\n Saved in `res/values/` and accessed from the `R.style` class.\n\n[Font resources](/guide/topics/resources/font-resource)\n: Define font families and include custom fonts in XML. \n\n Saved in `res/font/` and accessed from the `R.font` class.\n\n[More resource types](/guide/topics/resources/more-resources)\n: Define other primitive values as static resources, including the following:\n\n [Bool](/guide/topics/resources/more-resources#Bool)\n : XML resource that carries a boolean value.\n\n [Color](/guide/topics/resources/more-resources#Color)\n : XML resource that carries a hexadecimal color value.\n\n [Dimension](/guide/topics/resources/more-resources#Dimension)\n : XML resource that carries a dimension value with a unit of measure.\n\n [ID](/guide/topics/resources/more-resources#Id)\n : XML resource that provides a unique identifier for application resources and\n components.\n\n [Integer](/guide/topics/resources/more-resources#Integer)\n : XML resource that carries an integer value.\n\n [Integer array](/guide/topics/resources/more-resources#IntegerArray)\n : XML resource that provides an array of integers.\n\n [Typed array](/guide/topics/resources/more-resources#TypedArray)\n : XML resource that provides a [TypedArray](/reference/android/content/res/TypedArray), which you can use\n for an array of drawables."]]