Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Patterns and components
Stay organized with collections
Save and categorize content based on your preferences.
In Android 8.0, the Settings menu gains several components and widgets that
cover common uses. Device manufacturers and developers are encouraged to use the
common components when extending the Settings app so new user interfaces stay
consistent with the existing Settings UI.
Here is a summary of improvements:
- Divider behavior change in support library Preference framework. Divider is
now drawn between categories.
- ActionBar theme change. The ActionBar now uses light color theme, with
accent color text.
- New preference layout. The space for icons remains even when a preference
has no icon.
New widgets:
- A header widget for app details. Displays app icon, app label and
other information.
- An expand button on some pages. Page can start as collapsed and hide less
important items until user clicks expand button.
- Default app picker UI:
- The UI for choosing default browser, default phone app, etc.
- Formerly a dialog, now it's a full screen radio button-based UI.
- 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.
Examples and source
- Divider behavior
- All pages in Settings are modified to use the new divider behavior.
- The divider behavior is defined as a ThemeOverlay in:
packages/apps/Settings/res/values/styles_preference.xml
- ActionBar theme change
- All pages in Settings are modified to use the new ActionBar theme.
- The theme is defined in Theme.DeviceDefault.Settings
- New preference layout
- Many pages in Settings are now using the new preference layout.
- You can find the code in:
packages/apps/Settings/res/values/styles_preference.xml
- App header widget
- Most app information pages in Settings are already implementing the
new App header.
- Examples and code can be found at:
packages/apps/Settings/src/com/android/settings/applications/AppHeaderController.java
- Expand button
- Default app picker
- You can find the code for base class in:
packages/apps/Settings/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java
- There are several subclasses of DefaultAppPickerFragment, each implementing
a picker for different intent.
- MasterSwitch style preference
- Code is at:
https://cs.android.com/android/platform/superproject/+/main:packages/apps/Settings/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceController.java
- 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
Implementation
Device manufacturers can start using all of the new components out of the box.
If OEMs decide to implement a new "MasterSwitch" style preference or default app
picker, they should follow the examples in this document and the reference files
(Javadoc) written with each component for more details.
Customize the settings menu
- Divider behavior. To change how divider is drawn, update the style for Settings dividers and
change the value for the following:
allowDividerAbove
allowDividerBelow
allowDividerAfterLastItem
- ActionBar theme color. Activities should use
Theme.DeviceDefault.Settings
as their theme, or
create a custom theme using Theme.DeviceDefault.Settings
as parent.
- App header widget. Use setters in AppHeaderController to customize each field and call
build()
once all fields are set.
- Expand button:
- To fully disable the functionality, override the constructor for
ProgressiveDisclosureMixin and set keepExpanded to true.
- To customize how many items to show initially, call the
ProgressiveDisclosureMixin.setTileLimit()
method during fragment's
onAttach(Context)
method.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 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."]]