The Material Design Compoents 1.1.0
Added Material Theming, new components, dark theme support, and more
New features:
-
All components support dark themes
-
New date picker (with range selection and enhanced accessibility)
-
Extends the Floating Action button
-
Toggle button group
-
Support for Edge gesture navigation components in Android 10
-
Improve accessibility
-
New Material Theming (shape, plate, color)
-
Stability and quality improvement
Background description of the MDC
Material Components for Android (MDC) evolved from the previous Design Support Library to work with AndroidX. For version compatibility and transitions, the initial 1.0.0 version is equivalent to the Design library 28.0.0. Name changed from com. Android. Support. The design to the com. Google. Android. Material. However, the design library will not be updated after the subsequent update, which means that the design library will remain in the 1.0.0 version forever.
The specification of Material Design has evolved since 1.0.0. New specifications, guidelines and components have emerged to better represent the brand while maintaining the core principles of Material. The purpose of MDC is to provide developers with a library that implements these components and guidelines in code. As the guidelines change and update, MDC adjusts and updates to meet the new specifications.
What’s new in 1.1.0
**MDC has changed a lot since 1.0.0! ** If you are still using beta or 1.0.0, please move to 1.1.0 or later as soon as possible.
Material Theming
Material Theming allows you to better customize Material Design to reflect our brand, color, font and shape choices.
MDC 1.1.0 enables Material Theming in your Android application. All components support adjusting their colors, fonts, and shapes through themes, styles, new properties, and custom classes such as MaterialShapeDrawable.
/ / this place to inherit Theme. MaterialComponents. *<style name="Theme.MyApp" parent="Theme.MaterialComponents.*"> <! -- Color attributes -->
<item name="colorPrimary">@color/green_500</item>
<item name="colorPrimaryVariant">@color/green_700</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/orange_500</item>
<item name="colorSecondaryVariant">@color/orange_300</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorError">@color/red_700</item>
<item name="colorOnError">@color/white</item>
<item name="colorSurface">@color/white</item>
<item name="colorOnSurface">@color/black</item>
<item name="android:colorBackground">@color/white</item>
<item name="colorOnBackground">@color/black</item> <! -- Type attributes -->
<item name="textAppearanceHeadline1">
@style/TextAppearance.MyApp.Headline1
</item>
<item name="textAppearanceHeadline2">
@style/TextAppearance.MyApp.Headline2
</item>
<item name="textAppearanceHeadline3">
@style/TextAppearance.MyApp.Headline3
</item>
<item name="textAppearanceHeadline4">
@style/TextAppearance.MyApp.Headline4
</item>
<item name="textAppearanceHeadline5">
@style/TextAppearance.MyApp.Headline5
</item>
<item name="textAppearanceHeadline6">
@style/TextAppearance.MyApp.Headline6
</item>
<item name="textAppearanceSubtitle1">
@style/TextAppearance.MyApp.Subtitle1
</item>
<item name="textAppearanceSubtitle2">
@style/TextAppearance.MyApp.Subtitle2
</item>
<item name="textAppearanceBody1">
@style/TextAppearance.MyApp.Body1
</item>
<item name="textAppearanceBody2">
@style/TextAppearance.MyApp.Body2
</item>
<item name="textAppearanceCaption">
@style/TextAppearance.MyApp.Caption
</item>
<item name="textAppearanceButton">
@style/TextAppearance.MyApp.Button
</item>
<item name="textAppearanceOverline">
@style/TextAppearance.MyApp.Overline
</item> <! -- Shape attributes -->
<item name="shapeAppearanceSmallComponent">
@style/ShapeAppearance.MyApp.SmallComponent
</item>
<item name="shapeAppearanceMediumComponent">
@style/ShapeAppearance.MyApp.MediumComponent
</item>
<item name="shapeAppearanceLargeComponent">
@style/ShapeAppearance.MyApp.LargeComponent
</item>
</style>
Copy the code
A new component
There are many new Components in the Material Components library that have been added to MDC 1.1.0. And existing components also have new styles through the latest Design. If you use the Design library or MDC 1.0.0, components will automatically adopt these new styles. For example, the text has a new default appearance
Some of the new and updated components provided in MDC 1.1.0 include:
- Extend the FAB
- Date picker
- Switch button
- Bottom App bar
Black theme support
System-wide dark theme support was introduced in Android 10. Along with the Material Design guide. MDC can use the Material Dark theme immediately. It builds on the existing AppCompat DayNight functionality, so you don’t have to implement it from scratch:
- Themes: Now all MDC themes will have different ones
DayNight
Form. These are automatically available according to device configuration-night
和-not-night
Switch between resource locators. - New Colors: The default palette has been extended for dark themes. It should be adjusted
colorPrimary
colorSecondary
To desaturate the brand from dark themes. By defaultcolorSurface android:colorBackground
Use dark grey rather than black to reduce eye strain, make high levels more noticeable, and ensure proper contrast with text and other elements. - Elevation surface Brightening: All MDC components support their surface brightening to convey elevation in dark themes. The white overlay projection in the guide maps onto the component Settings
elevation
The numerical values. - Accessibility: MDC uses colors to distinguish accessibility. (colorSurface and colorOnSurface) An important aspect of distinguishing between accessible and inaccessible in dark subjects is by having enough contrast between colors! MDC now uses recommended colors and opacity to ensure this is the case.
- Primary and Surface Color switching: The MDC component follows guidelines to reduce the use of Primary colors in dark themes. For example, you can see it in the toolbar
colorSurface
To replace thecolorPrimary
As its background color. This is made up of a new color attributecolorPrimarySurface
(More current models are incolorPrimary
和colorSurface
Switch between) and componentPrimarySurface
Style to provide support.
Android 10 gesture support
Gesture navigation was introduced in Android10. Some MDC components are often in the area of the main gesture (for example, the BottomNavigationView and the original gesture that slides up from the bottom). Components have been updated to account for these gesture areas as well as device orientation. The appropriate padding/margin value will be applied automatically using the WindowInsets API(on Android 10 or later).
Accessibility improvements
Many accessibility improvements have been added to the MDC component. This mainly involves better “verbal cues” in useful content descriptions, functions and order of parts. For example, TextInputLayout now reads its prompts, input, and helper or error text in the correct order.
Next steps of MDC
We have received your feedback on the MDC release. We are committed to updating and integrating your important contributions.
Original address: medium.com/google-desi…