Compatibility
Although many new features have been added to material design, not all new content is compatible with the pair.
Using the V7 Package
The V7 support libraries R21 and later versions contain the following material design features:
- Use the Theme.appcompat theme to include the palette body properties to make a uniform color match for the applied theme, but excluding the status bar and the bottom action bar
- Recyclerview and CardView are independent and can be adapted to all versions of more than 7 as long as the jar package is introduced.
- Palette class for extracting master tones from pictures
System components
The material Design style for these components is provided in the Theme.appcompat topic:
- EditText
- Spinner
- CheckBox
- RadioButton
- Switchcompat
- Checkedtextview
- Color Palette
Create multiple value and layout
For Android L We can create value-v21 to specify the material design theme, while specifying Theme.appcompat in other value. Layout layouts can also be used in this way, using system controls in Android L, and using our custom controls in a lower version to live with a third-party package to achieve that effect.
Note Version checking
The following features are only available in Android 5.0 (API level 21) and above:
- Transition animations
- Touch Feedback
- Circular Display Animation
- Path animation
- Vector diagram
- Tint staining
Therefore, in the code to meet the use of these APIs in the place need to make version judgment:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // 使用新特性} else { // 用其他替代方式}
Third-party support library rippledrawable
Provides a touch-feedback effect, which is a water ripple under 5.0 button press.
- Https://github.com/03uk/RippleDrawable
- Https://github.com/siriscac/RippleView
- Https://github.com/balysv/material-ripple
State animation
Https://github.com/NghiaTranUIT/Responsive-Interaction-Control
Material Design-style dialog box
Https://github.com/lewisjdeane/L-Dialogs
Material design-style Compatibility pack
Provides a number of control effects https://github.com/navasmdc/MaterialDesignLibrary
Systembartint
Support for modifying the status bar and bottom action Bar https://github.com/jgilfelt/SystemBarTint
Android5.0 new feature-compatibility (support)