از 27 مارس 2025، توصیه می کنیم از android-latest-release
به جای aosp-main
برای ساختن و کمک به AOSP استفاده کنید. برای اطلاعات بیشتر، به تغییرات AOSP مراجعه کنید.
نوار ابزار
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Dialer از نوار ابزار شاسی با نام بسته com.android.car.ui.toolbar.Toolbar
استفاده می کند. اولین قدم برای سفارشی کردن نوار ابزار، همپوشانی فایل layout است که عبارتاند از car_ui_toolbar.xml
و car_ui_toolbar_two_row.xml
برای نوار ابزار قدیمی و car_ui_base_layout_toolbar.xml
برای نسخه اصلی. در هر نسخه از طرح، هر یک از نماهای زیر باید با شناسه های مربوطه ارائه شود:
شناسه | نوع مشاهده | شرح |
---|
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
را نیز سفارشی کنید، که حاوی نوار جستجو است که باید نماهای زیر را داشته باشد:
شناسه | نوع مشاهده | شرح |
---|
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
نمایش داده می شوند، پنهان می شوند یا تغییر می کنند. برای جزئیات بیشتر در مورد اینکه کدام نما و چه زمانی نمایش داده می شود، به آن روش مراجعه کنید.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-29 بهوقت ساعت هماهنگ جهانی."],[],[],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."]]