列表滑動時,頭部 itemView 縮放動畫
阿新 • • 發佈:2018-11-07
VegaLayoutManager
專案地址:xmuSistone/VegaLayoutManager
簡介:列表滑動時,頭部 itemView 縮放動畫
標籤:
RecyclerView-LayoutManager-item動畫-
a customized LayoutManager - fade and shrink the head itemView when scrolling.
實現效果
Dribbble 設計: 連結
IOS 實現:VegaScroll
程式碼思路
RecyclerView 最頂部的 itemView,會隨著手指滑動實現收縮隱藏與放大顯示,並伴隨 recycler 的回收與複用。
程式碼比較簡單粗暴,使用自定義的 LayoutManger,內建 SnapHelper。
由於想要在任意時刻都能 snap 到第一個子 View,所以在 LayoutManager 中用了比較討巧的方法去設定 scroll 的最大值。
使用方法
- gradle 引入
compile 'com.stone.vega.library:VegaLayoutManager:1.0.6'
- java 檔案中設定 LayoutManager
recyclerView.setLayoutManager(new VegaLayoutManager());
demo 下載
License
Copyright 2017, xmuSistone Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.