分享一個不錯的效果,分享給你們android
BouncingJellyView 果凍視圖,就像果凍同樣伸縮彈跳,也叫阻尼效果。這個效果在MIUI上面處處均可以看到。git
效果圖:github
使用app
項目更目錄bulid.gradle下maven
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}佈局
app目錄下bulid.gradle中gradle
compile 'com.github.aohanyao:BouncingJelly:1.0.4'url
佈局spa
<?xml version="1.0" encoding="utf-8"?> <com.aohanyao.jelly.library.BouncingJellyView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <!--這裏面放阻尼效果的佈局--> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never" /> </LinearLayout> </com.aohanyao.jelly.library.BouncingJellyView>
這樣就能夠了,很簡單code
代碼:https://github.com/aohanyao/BouncingJelly/tree/master