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.