Android 5.0 new control instance details
Google launched some new controls while launching Android 5.0. The following five new controls are most commonly used in Android 5.0.
1. Cardview
As the name suggests, cardview is a card view, which inherits FrameLayout. It is a FrameLayout with rounded backgrounds and shadows. Cardview is packaged as a layout and is often used as a container in the item layout of listview and recyclerview. The use of cardview is very simple:
2. Patelle (palette)
Patelle is an auxiliary class, which is used to obtain prominent colors from pictures. It can extract the prominent colors of the following properties:
-Vibrant - vibrant dark - vibrant light - muted - muted dark - muted light
Patelle is also very simple to use:
3. Toolbar
Toolbar, as its name implies, is a toolbar. It appears as a substitute for actionbar. Google recommends using toolbar instead of actionbar. The toolbar can be placed anywhere. Unlike the actionbar, it can only be placed in a fixed position. The toolbar supports more focused features than the actionbar. The toolbar may contain a combination of the following optional elements: - navigation buttons - logo image of the brand - title and subtitle - one or more custom views
4. Ripple drawable
Rippledrawable, as its name implies, is a ripple graph, which can only be used above Android 5.0. At present, there is no downward compatible support package for rippledrawable. Rippledrawable displays a ripple effect in response to a state change.
Define a UI's background image as rippledrawable Android: background = "@ drawable / ripple"
Define a rippledrawable XML file under the drawable folder
Android: Color: indicates the color of the ripple
< item >: indicates the items below the ripple diagram
Take a look at the ripple effect of clicking the button
5. Recyclerview
Recyclerview is a substitute for listview. Google recommends using recyclerview instead of listview.
Recyclerview provides more flexible use than listview, and its performance is better than listview.
Recyclerview can set linear, grid, waterfall and flow layout managers.
-Linear layout manager - gridlayoutmanager - cascadedgridlayoutmanager
Note: recyclerview, patelle and cardview are in separate support packages, not in appcompat-v7 and its dependent sub packages
To use them, you must import their dependent packages