分享一個不錯的效果,分享給大家
BouncingJellyView 果凍視圖,就像果凍一樣伸縮彈跳,也叫阻尼效果。這個效果在MIUI上面到處都可以看到。
效果圖:
使用
項目更目錄bulid.gradle下
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
app目錄下bulid.gradle中
compile 'com.github.aohanyao:BouncingJelly:1.0.4'
佈局
<?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>
這樣就可以了,很簡單
代碼:https://github.com/aohanyao/BouncingJelly/tree/master