이 페이지에서는 CarUiRecyclerView 및 스크롤바를 맞춤설정하는 프로세스를 설명합니다.
기본 요건
이 페이지에서는 런타임 리소스 오버레이(RRO) 타겟 APK를 알고 있다고 가정합니다. 자세한 내용은 앱 맞춤설정을 참고하세요.
CarUiRecyclerView 정보
car_ui_scrollbar_enable이 bools.xml에서 false로 설정되면 CarUiRecyclerView는 스크롤바를 확장하지 않습니다. 즉, androidx.recyclerview만 아래에 정의된 대로 맞춤설정 가능한 스타일로 확장됩니다.
car_ui_scrollbar_enable이 true로 설정되면 CarUiRecyclerView는 스크롤바가 내부에 설치된 컨테이너를 확장합니다. 나중에는 androidx.recyclerview도 동일한 컨테이너 내에 추가됩니다.
CarUiRecyclerView는 데이터를 표시하기 위해 어떤 어댑터라도 사용할 수 있습니다. 그러나 CarUiListItemAdapter를 사용하는 것이 좋습니다. 이 어댑터에서 chassis lib는 ListItem의 레이아웃을 정의하므로 OEM에서 맞춤설정할 수 있습니다. ListItem 맞춤설정은 CarUiListItem 맞춤설정 옵션에 정의되어 있습니다.
기본적으로 car_ui_scrollbar_margin은 스크롤바 뷰의 너비로 사용됩니다.
이 여백은 CarUiRecyclerView의 android:endMargin으로 추가되므로 데이터 시작과 끝 부분에 동일한 여백이 있습니다. 개발자가 enableDivider=true를 사용했다면 OEM은 구분선이 표시되어야 하는 방식을 제어할 수 있습니다.
CarUiRecyclerView에 대해 조정할 수 있는 크기는 다음과 같습니다.
Up, Down 또는 thumb 드로어블을 업데이트해야 한다면 이러한 드로어블도 오버레이해야 합니다.
아직 존재하지 않는 새 리소스가 RRO 패키지에서 사용되는 경우 이러한 리소스는 개발자가 생성하는 RRO APK에도 정의되어야 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 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,["# Customize CarUiRecyclerView\n\nThis page describes the process of customizing`CarUiRecyclerView` and the scroll\nbar.\n\nPrerequisites\n-------------\n\nThis page presumes knowledge of a runtime resource overlay (RRO) target APK. To learn\nmore, see [Customize apps](/docs/automotive/hmi/car_ui/customize).\n\nAbout CarUiRecyclerView\n-----------------------\n\nWhen `car_ui_scrollbar_enable` is set to `false` in `bools.xml`,\n`CarUiRecyclerView` doesn't inflate the scrollbar. That said, only the\n`androidx.recyclerview` is inflated with customizable styles as defined below.\nWhen `car_ui_scrollbar_enable` is set to `true`,\n`CarUiRecyclerView` inflates the container with the scrollbar installed\nwithin it. Later `androidx.recyclerview` is also added within the same\ncontainer.\n\n`CarUiRecyclerView` can take any adapter to display the data. But the\nrecommendation is to use `CarUiListItemAdapter` where the chassis lib defines the\nlayout for listItems and hence can be customized by OEMs. The customization for ListItems\nare defined in [Customization\noptions for CarUiListItem](/docs/automotive/hmi/car_ui/caruilistitem).\n\nBy default, `car_ui_scrollbar_margin` is used as the width of the scrollbar view.\nThis margin is also added as `android:endMargin` of the CarUiRecyclerView so\nthere is equal margin at the start and end of the data. If the developer had used\n`enableDivider=true` then the OEM can control how the dividers should appear.\nDimensions that can be adjusted for `CarUiRecyclerView` are: \n\n```scdoc\n \u003cdimen name=\"car_ui_recyclerview_divider_height\"\u003e0dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_recyclerview_divider_start_margin\"\u003e0dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_recyclerview_divider_end_margin\"\u003e0dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_recyclerview_divider_top_margin\"\u003e0dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_recyclerview_divider_bottom_margin\"\u003e0dp\u003c/dimen\u003e\n```\n\nScrollbar\n---------\n\n| **Note:** You can only customize scrollbar layout in releases of Android 10 and higher.\n\nThe layout file for `CarUiRV` scrollbar is defined in\n`car_ui_recyclerview_scrollbar.xml`. In total, these four views are\ndefined within the view:\n\n| Views ||\n|------------------------------|---------------------------------------------------------------------------------------------------|\n| `Car_ui_scrollbar_page_up` | Defines the up button of the scrollbar. |\n| `Car_ui_scrollbar_page_down` | defines the down button of the scrollbar. |\n| `Car_ui_scrollbar_thumb` | Height is calculated dynamically depending on the number of list items in the Recycler View (RV). |\n| `Car_ui_scrollbar_track` | Total height that defines the bounds in which the thumb will move. |\n\nOEMs should overlay this layout file to customize the scrollbar. Track view should be\nplaced carefully as that would define the bounds in which the thumb will move.\nThumb height is calculated dynamically based on the list items in the RV and the height\nof the viewholders.\n\nThis layout is included in the `CarUiRV` container\n`car_ui_recycler_view.xml` **only** if `car_ui_scrollbar_enable`\nis `true`.\n\nOther dimensions that can be adjusted for scrollbar are: \n\n```carbon\n \u003cdimen name=\"car_ui_scrollbar_container_width\"\u003e@dimen/car_ui_margin\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_button_size\"\u003e@dimen/car_ui_touch_target_width\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_thumb_width\"\u003e7dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_separator_margin\"\u003e16dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_margin\"\u003e@dimen/car_ui_margin\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_thumb_radius\"\u003e100dp\u003c/dimen\u003e\n\n \u003citem name=\"car_ui_button_disabled_alpha\" format=\"float\" type=\"dimen\"\u003e0.2\u003c/item\u003e\n \u003citem name=\"car_ui_scrollbar_milliseconds_per_inch\" format=\"float\" type=\"dimen\"\u003e150.0\u003c/item\u003e\n \u003citem name=\"car_ui_scrollbar_deceleration_times_divisor\" format=\"float\" type=\"dimen\"\u003e0.45\u003c/item\u003e\n \u003citem name=\"car_ui_scrollbar_decelerate_interpolator_factor\" format=\"float\" type=\"dimen\"\u003e1.8\u003c/item\u003e\n\n \u003cdimen name=\"car_ui_scrollbar_padding_start\"\u003e0dp\u003c/dimen\u003e\n \u003cdimen name=\"car_ui_scrollbar_padding_end\"\u003e0dp\u003c/dimen\u003e\n```\n\nExample\n-------\n\nFor example, to bring both the Up and Down arrow together at the bottom of the screen:\n\n1. Overlay `car_ui_recyclerview_scrollbar.xml`: \n\n ```transact-sql\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cRelativeLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"@dimen/car_ui_margin\"\n android:layout_height=\"match_parent\"\n android:id=\"@+id/car_ui_scroll_bar\"\u003e\n\n \u003c!-- View height is dynamically calculated during layout. --\u003e\n \u003cView\n android:id=\"@+id/car_ui_scrollbar_thumb\"\n android:layout_width=\"7dp\"\n android:layout_height=\"20dp\"\n android:layout_alignParentTop=\"true\"\n android:layout_centerHorizontal=\"true\"\n android:background=\"@drawable/car_ui_recyclerview_scrollbar_thumb\"/\u003e\n\n \u003cView\n android:id=\"@+id/car_ui_scrollbar_track\"\n android:layout_width=\"10dp\"\n android:layout_height=\"match_parent\"\n android:layout_marginTop=\"10dp\"\n android:layout_centerHorizontal=\"true\"\n android:layout_above=\"@+id/car_ui_scrollbar_page_up\"/\u003e\n\n \u003cImageView\n android:id=\"@+id/car_ui_scrollbar_page_up\"\n android:layout_width=\"76dp\"\n android:layout_height=\"76dp\"\n android:focusable=\"false\"\n android:hapticFeedbackEnabled=\"false\"\n android:src=\"@drawable/car_ui_recyclerview_ic_up\"\n android:scaleType=\"centerInside\"\n android:layout_centerHorizontal=\"true\"\n android:layout_above=\"@+id/car_ui_scrollbar_page_down\"/\u003e\n\n \u003cImageView\n android:id=\"@+id/car_ui_scrollbar_page_down\"\n android:layout_width=\"76dp\"\n android:layout_height=\"76dp\"\n android:focusable=\"false\"\n android:hapticFeedbackEnabled=\"false\"\n android:src=\"@drawable/car_ui_recyclerview_ic_down\"\n android:scaleType=\"centerInside\"\n android:layout_centerHorizontal=\"true\"\n android:layout_alignParentBottom=\"true\"/\u003e\n \u003c/RelativeLayout\u003e\n ```\n2. To define the resources to be overlaid by the RRO, add `Overlays.xml`: \n\n ```transact-sql\n \u003coverlay\u003e\n \u003citem target=\"id/car_ui_scroll_bar\" value=\"@id/car_ui_scroll_bar\"/\u003e\n \u003citem target=\"id/car_ui_scrollbar_thumb\" value=\"@id/car_ui_scrollbar_thumb\"/\u003e\n \u003citem target=\"id/car_ui_scrollbar_track\" value=\"@id/car_ui_scrollbar_track\"/\u003e\n \u003citem target=\"id/car_ui_scrollbar_page_up\" value=\"@id/car_ui_scrollbar_page_up\"/\u003e\n \u003citem target=\"id/car_ui_scrollbar_page_down\" value=\"@id/car_ui_scrollbar_page_down\"/\u003e\n \u003citem target=\"layout/car_ui_recyclerview_scrollbar\" value=\"@layout/car_ui_recyclerview_scrollbar\"/\u003e\n \u003c/overlay\u003e\n ```\n3. If an Up, Down, or thumb drawable must be updated, they should also be overlaid.\n4. If any new resources are used in the RRO package that do not already exist, then these resources should also be defined in the RRO APK you create."]]