2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
패턴 및 구성요소
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android 8.0에서는 일반적인 용도를 아우르는 여러 구성요소와 위젯이 설정 메뉴에 추가되었습니다. 기기 제조업체 및 개발자는 새로운 사용자 인터페이스가 기존 설정 UI와 일관성을 유지하도록 설정 앱 확장 시 일반 구성요소를 사용하는 것이 좋습니다.
아래에는 개선사항이 요약되어 있습니다.
- 지원 라이브러리 환경설정 프레임워크의 구분선 동작 변경. 이제 구분선이 카테고리 사이에 표시됩니다.
- ActionBar 테마 변경. 이제 ActionBar에서 밝은 색상의 테마와 강조 색상 텍스트 사용합니다.
- 새로운 환경설정 레이아웃. 환경설정에 아이콘이 없는 경우에도 아이콘 공간이 유지됩니다.
새 위젯:
- 앱 세부정보와 관련된 헤더 위젯입니다. 앱 아이콘, 앱 라벨 및 기타 정보가 표시됩니다.
- 일부 페이지의 펼치기 버튼. 페이지를 접힌 상태로 시작할 수 있으며 사용자가 펼치기 버튼을 클릭할 때까지 덜 중요한 항목을 숨길 수 있습니다.
- 기본 앱 선택 UI:
- 기본 브라우저, 기본 전화 앱 등을 선택하기 위한 UI입니다.
- 이전에는 대화상자 였지만 지금은 전체 화면 라디오 버튼에 기반한 UI입니다.
- 'MasterSwitch' 스타일의 환경설정입니다. 이 환경설정에는 두 개의 클릭 타겟이 있습니다. 왼쪽 타겟은 하위 설정 프래그먼트 또는 인텐트로 이어집니다. 오른쪽 타겟은 전체 페이지의 켜기/끄기를 제어하는 전환 토글입니다.
예시 및 소스
- 구분선 동작입니다.
- 설정의 모든 페이지가 새로운 구분선 동작을 사용하도록 수정됩니다.
- 구분선 동작이 다음의 ThemeOverlay로 정의됨:
packages/apps/Settings/res/values/styles_preference.xml
- ActionBar 테마 변경
- 새 ActionBar 테마를 사용하도록 설정의 모든 페이지가 수정됩니다.
- 테마는 Theme.DeviceDefault.Settings에 정의되어 있습니다.
- 새 환경설정 레이아웃
- 이제 설정의 다수 페이지에서 새로운 환경설정 레이아웃을 사용합니다.
- 코드 위치:
packages/apps/Settings/res/values/styles_preference.xml
- 앱 헤더 위젯입니다.
- 설정의 앱 정보 페이지 대부분이 이미 새 앱 헤더를 구현하고 있습니다.
- 예시 및 코드 위치:
packages/apps/Settings/src/com/android/settings/applications/AppHeaderController.java
- 펼치기 버튼:
- 기본 앱 선택 도구
- 기본 클래스의 코드 위치:
packages/apps/Settings/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java
- DefaultAppPickerFragment의 여러 서브클래스가 있으며 각 서브클래스는 다양한 인텐트의 선택기를 구현합니다.
- MasterSwitch 스타일 환경설정
- 코드 위치:
https://cs.android.com/android/platform/superproject/+/main:packages/apps/Settings/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceController.java
- 사용 사례 예시는 Wi-Fi 기본 스위치입니다. 예시 위치:
packages/apps/Settings/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
구현
기기 제조업체는 모든 새로운 구성요소를 바로 사용할 수 있습니다.
새로운 'MasterSwitch' 스타일 환경설정이나 기본 앱 선택기를 구현하기로 결정한 OEM은 이 문서의 예시, 그리고 추가적인 세부정보를 위해 각 구성요소에 대해 작성된 참조 파일(Javadoc)을 따라야 합니다.
설정 메뉴 맞춤설정
- 구분선 동작입니다. 구분선이 표시되는 방식을 변경하려면 설정 구분선의 스타일을 업데이트하고 다음의 값을 변경합니다.
allowDividerAbove
allowDividerBelow
allowDividerAfterLastItem
- ActionBar 테마 색상입니다. 활동에
Theme.DeviceDefault.Settings
를 테마로 사용하거나 Theme.DeviceDefault.Settings
를 상위 요소로 사용하여 맞춤 테마를 생성해야 합니다.
- 앱 헤더 위젯입니다. AppHeaderController에 setter를 사용하여 각 필드를 맞춤설정하고 모든 필드가 설정되면
build()
를 호출합니다.
- 펼치기 버튼:
- 기능을 완전히 사용 중지하려면 ProgressiveDisclosureMixin의 생성자를 재정의하고 keepExpanded를 true로 설정합니다.
- 처음에 몇 개의 항목을 표시할지 맞춤설정하려면 프래그먼트의
onAttach(Context)
메서드 도중 ProgressiveDisclosureMixin.setTileLimit()
메서드를 호출합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 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,["# Patterns and components\n\nIn Android 8.0, the Settings menu gains several components and widgets that\ncover common uses. Device manufacturers and developers are encouraged to use the\ncommon components when extending the Settings app so new user interfaces stay\nconsistent with the existing Settings UI.\n\n\nHere is a summary of improvements:\n\n- Divider behavior change in support library Preference framework. Divider is now drawn between categories.\n- ActionBar theme change. The ActionBar now uses light color theme, with accent color text.\n- New preference layout. The space for icons remains even when a preference has no icon.\n\n\nNew widgets:\n\n- A header widget for app details. Displays app icon, app label and other information.\n- An expand button on some pages. Page can start as collapsed and hide less important items until user clicks expand button.\n- Default app picker UI:\n - The UI for choosing default browser, default phone app, etc.\n - Formerly a dialog, now it's a full screen radio button-based UI.\n- A \"MasterSwitch\" style preference. This is a preference with two click targets. Left target leads to a subsetting fragment or intent. Right target is a switch toggle, controlling on/off for the entire page.\n\nExamples and source\n-------------------\n\n- Divider behavior\n - All pages in Settings are modified to use the new divider behavior.\n - The divider behavior is defined as a ThemeOverlay in: \n `packages/apps/Settings/res/values/styles_preference.xml`\n- ActionBar theme change\n - All pages in Settings are modified to use the new ActionBar theme.\n - The theme is defined in Theme.DeviceDefault.Settings\n- New preference layout\n - Many pages in Settings are now using the new preference layout.\n - You can find the code in: \n `packages/apps/Settings/res/values/styles_preference.xml`\n- App header widget\n - Most app information pages in Settings are already implementing the new App header.\n - Examples and code can be found at: \n `packages/apps/Settings/src/com/android/settings/applications/AppHeaderController.java`\n- Expand button\n - Examples and code can be found at: \n `packages/apps/Settings/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java`\n\n **Note:** This component must be used together with\n DashboardFragment. (See more details about DashboardFragment in [Updated Information Architecture](/docs/core/settings/info-architecture).)\n- Default app picker\n - You can find the code for base class in: \n `packages/apps/Settings/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java`\n - There are several subclasses of DefaultAppPickerFragment, each implementing a picker for different intent.\n- *MasterSwitch* style preference\n - Code is at: `https://cs.android.com/android/platform/superproject/+/main:packages/apps/Settings/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceController.java`\n - An example use case is Wi-Fi primary switch. You can find an example at: `packages/apps/Settings/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java`\n\nImplementation\n--------------\n\n\nDevice manufacturers can start using all of the new components out of the box.\nIf OEMs decide to implement a new \"MasterSwitch\" style preference or default app\npicker, they should follow the examples in this document and the reference files\n(Javadoc) written with each component for more details.\n\nCustomize the settings menu\n---------------------------\n\n- Divider behavior. To change how divider is drawn, update the style for Settings dividers and change the value for the following:\n - `allowDividerAbove`\n - `allowDividerBelow`\n - `allowDividerAfterLastItem`\n- ActionBar theme color. Activities should use `Theme.DeviceDefault.Settings` as their theme, or create a custom theme using `Theme.DeviceDefault.Settings` as parent.\n- App header widget. Use setters in AppHeaderController to customize each field and call `build()` once all fields are set.\n- Expand button:\n - To fully disable the functionality, override the constructor for ProgressiveDisclosureMixin and set keepExpanded to true.\n - To customize how many items to show initially, call the `ProgressiveDisclosureMixin.setTileLimit()` method during fragment's `onAttach(Context)` method."]]