החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
סרגל כלים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
Dialer משתמש בסרגל הכלים של המארז עם שם החבילה com.android.car.ui.toolbar.Toolbar
.
השלב הראשון בהתאמה אישית של סרגל הכלים הוא להוסיף שכבה לקובץ הפריסה. השמות של קובצי הפריסה הם car_ui_toolbar.xml
ו-car_ui_toolbar_two_row.xml
עבור סרגל הכלים הקודם, ו-car_ui_base_layout_toolbar.xml
עבור גרסת ברירת המחדל של הפריסה. בכל גרסה של הפריסה, צריך לספק את המזהים המתאימים לכל אחד מהתצוגות הבאות:
id |
סוג התצוגה |
תיאור |
car_ui_toolbar_background /td>
| android.view.View |
הוצא משימוש בפריסות בסיס, אבל משמש עם הסגנון הקודם של סרגל הכלים כדי לקבוע את הגובה. |
car_ui_toolbar_tabs |
com.android.car.ui.toolbar.TabLayout |
מיקום הכרטיסיות. |
car_ui_toolbar_nav_icon |
android.widget.ImageView |
לחצן 'הקודם', 'סגירה', 'חץ למטה'. |
car_ui_toolbar_logo |
android.widget.ImageView |
הלוגו, כאשר car_ui_toolbar_logo_ fills_nav_icon_space הוא true . |
car_ui_toolbar_nav_icon_container |
android.view.ViewGroup |
קונטיינר לאחסון car_ui_toolbar_logo ו-car_ui_toolbar_nav_icon . |
car_ui_toolbar_menu_items_container |
android.view.ViewGroup |
רכיב ViewGroup שמשמש לאחסון פריטים בתפריט. |
car_ui_toolbar_title |
android.widget.TextView |
כותרת סרגל הכלים. |
car_ui_toolbar_title_logo_container |
android.view.ViewGroup |
מאגר של car_ui_toolbar_title_logo . המארז יוצג (או יוסתר) במקום ImageView. |
car_ui_toolbar_title_logo |
android.widget.ImageView |
הלוגו, כאשר car_ui_toolbar_logo_ fills_nav_icon_space הוא false |
car_ui_toolbar_search_view_container |
android.widget.FrameLayout |
מאגר שבו תצוגת החיפוש תתרחב. כך משך הזמן של הנפחים יתקצר במסכים ללא סרגל חיפוש. |
car_ui_toolbar_progress_bar |
android.widget.ProgressBar |
סרגל התקדמות. |
בשלב הבא, צריך גם להתאים אישית את car_ui_toolbar_search_view.xml
, שמכיל את סרגל החיפוש, שצריך לכלול את התצוגות הבאות:
id |
סוג התצוגה |
תיאור |
car_ui_toolbar_search_bar |
android.widget.EditText |
EditText שבו המשתמש מקלידים טקסט לחיפוש. |
car_ui_toolbar_search_icon |
android.widget.ImageView |
סמל, שבדרך כלל מוצג בו סמל חיפוש, אבל אפליקציות יכולות לשנות אותו. |
car_ui_toolbar_search_close |
android.view.View |
תצוגה שבלחיצה עליה תיבת החיפוש תתבהר |
בנוסף לפריסה, אפשר להשתמש במאפיינים הבוליאניים הבאים כדי להתאים אישית את סרגל הכלים:
מאפיין |
תיאור |
car_ui_toolbar_tabs_on_second_row |
קובעת אם להסתיר את הכותרת כשמוצגות כרטיסיות. |
car_ui_toolbar_nav_icon_reserve_space |
ההגדרה קובעת אם הכותרת צריכה לזוז שמאלה כדי למלא את המרחב של סמל הניווט כשהסמל מוסתר. |
car_ui_toolbar_logo_fills_nav_icon_space |
הצגת הלוגו באותו מקום שבו מופיע לחצן הניווט, אם לחצן הניווט לא מופיע. |
car_ui_toolbar_show_logo |
כדי להשבית לתמיד את הצגת הלוגו בסרגל הכלים, מגדירים את הערך הזה כ-false . |
התצוגות האלה מוצגות, מוסתרות או משתנות בהתאם ל-setState
של השיטה ToolbarControllerImpl
. למידע ספציפי על התצוגה שמוצגת ומתי היא מוצגת, קראו את המאמר בנושא השיטה הזו.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Toolbar\n\nDialer uses the chassis toolbar with a package name of\n`com.android.car.ui.toolbar.Toolbar`.\n\nThe first step to customizing the toolbar is to overlay the layout file, which is\n`car_ui_toolbar.xml` and `car_ui_toolbar_two_row.xml` for the legacy toolbar,\nand `car_ui_base_layout_toolbar.xml` for the base layout version. In each version of the\nlayout, each of the following views must be provided with the respective ids:\n\n| id | View type | Description |\n|----------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| `car_ui_toolbar_background`/td\\\u003e | `android.view.View` | Deprecated for base layouts, but used with the previous toolbar style to determine height. |\n| `car_ui_toolbar_tabs` | `com.android.car.ui.toolbar.TabLayout` | Location of tabs. |\n| `car_ui_toolbar_nav_icon` | `android.widget.ImageView` | The Back, Close, Down button. |\n| `car_ui_toolbar_logo` | `android.widget.ImageView` | The logo, when car_ui_toolbar_logo_ fills_nav_icon_space is `true`. |\n| `car_ui_toolbar_nav_icon_container` | `android.view.ViewGroup` | A container to hold `car_ui_toolbar_logo` and `car_ui_toolbar_nav_icon`. |\n| `car_ui_toolbar_menu_items_container` | `android.view.ViewGroup` | A ViewGroup to contain MenuItems. |\n| `car_ui_toolbar_title` | `android.widget.TextView` | The title of the toolbar. |\n| `car_ui_toolbar_title_logo_container` | `android.view.ViewGroup` | A container for the `car_ui_toolbar_title_logo`. The container will be displayed (or hidden) instead of the ImageView. |\n| `car_ui_toolbar_title_logo` | `android.widget.ImageView` | The logo, when car_ui_toolbar_logo_ fills_nav_icon_space is `false` |\n| `car_ui_toolbar_search_view_container` | `android.widget.FrameLayout` | A container into which the search view is to be inflated. This reduces inflation durations on screens without Search bars. |\n| `car_ui_toolbar_progress_bar` | `android.widget.ProgressBar` | A progress bar. |\n\nNext, you must also customize `car_ui_toolbar_search_view.xml`, which contains the\nSearch bar, which must have the following views:\n\n| id | View type | Description |\n|-------------------------------|----------------------------|--------------------------------------------------------------------------------|\n| `car_ui_toolbar_search_bar` | `android.widget.EditText` | The EditText where the user types text to search. |\n| `car_ui_toolbar_search_icon` | `android.widget.ImageView` | An icon, that normally shows a search icon but can be changed by applications. |\n| `car_ui_toolbar_search_close` | `android.view.View` | A view that when clicked will clear the search box |\n\nIn addition to the layout, you can use these Boolean attributes to customize the toolbar:\n\n| Attribute | Description |\n|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| `car_ui_toolbar_tabs_on_second_row` | Determines whether or not to hide the title when tabs are displayed. |\n| `car_ui_toolbar_nav_icon_reserve_space` | Determines if the title should be moved to the left to occupy the space of the Navigation icon when the Navigation icon is hidden. |\n| `car_ui_toolbar_logo_fills_nav_icon_space` | Display the logo in the same space as the Navigation button when no Navigation button is present. |\n| `car_ui_toolbar_show_logo` | To permanently disable the display of a logo in the toolbar, set this to `false`. |\n\nThese views are displayed, hidden, or changed based on the `setState` of the\n`ToolbarControllerImpl` method. For specifics about which view is displayed and when,\nsee that method."]]