CoordinatorLayout与滚动的处理
转自 泡在网上的日子 CoordinatorLayout与滚动的处理
概览
CoordinatorLayout 实现了多种Material Design中提到的滚动效果。目前这个框架提供了几种不用写动画代码就能工作的方法,这些效果包括:
- 让浮动操作按钮上下滑动,为Snackbar留出空间。
- 扩展或者缩小Toolbar或者头部,让主内容区域有更多的空间。
- 控制哪个view应该扩展还是收缩,以及其显示大小比例,包括视差滚动效果动画。
首要
遵循Design Support Library设计规范
Features
The support design library has the following key features:
-
1.FloatingActionButton - A round button at the bottom right denoting a primary action on your interface. Promoting key actions within a modern material design app.
-
2.TabLayout - An easier way to put tabs around a ViewPager which acts as sliding tabs between fragments within an app.
-
3.NavigationView - An easier way to provide a modern navigation drawer from the left with a header and a series of navigation items.
-
4.SnackBar - Shown on the bottom of the screen and contains text with an optional single action. They automatically time out after the given time length by animating off the screen.
-
5.TextInputLayout - Float the hint above any text field as the user is entering information and/or add a character counter.
-
6.CoordinatorLayout - Provides an additional level of control over scroll and touch events between child views.
-
AppBarLayout allows your toolbar and other views to react to scroll events.
-
CollapsingToolbarLayout extend this to allow the toolbar to collapse as the user scrolls through a view.
-
Bottom Sheets to expose a sheet of material that slides up from the bottom of the screen.
-
-
7.PercentRelativeLayout and PercentFrameLayout to enable views to occupy percentage-based dimensions.
-
8.Vector Drawables to reduce the need to include images for every density size.
- Vector drawables are compatible back to Android 2.1 (API 7), but animated vector drawables are only back-ported to Android 3.0 (API 11).
-
9.Animating view hierarchies using the Transitions framework down to Android 4.0 (API 14) . Currently, there is no backported support for activity/fragment transitions used in this API.
-
10.Bottom Navigation Views for easily switching from 3 to 5 tabbed items.