• An overview of the
    • RefreshLayout implementation of TwinklingRebound writing method
    • More custom properties for drop-down refresh on TwinklingRefreshLayout
    • Custom PullToRefresh implementation of boundback and refresh operations

Summary:

Android native pages often have that same kind of bounce back effect that you see on iOS, so it feels like it’s really nice, not necessarily iOS, but just for the sake of it, so RefreshLayout is a layout file that’s basically RelativeLayout, It can do pull-up and pull-down loading animations like PullToRefush, it can also do pure out-of-bounds bouncing without any animations, and it is compatible with RecycleView, ListView and other sliding layouts. There is no need to deal with the sliding conflict of ScrollView nested RecycleView and so on, resulting in page stuck, ItemView can not be reused and a series of problems.

RefreshLayout implementation of TwinklingRebound writing method

1, adding dependent buildgrade: compile ‘com. Lcodecorex: tkrefreshlayout: 1.0.7 XML layout file (this is nested RecycleView and paging loading)

      <com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:tr_pureScrollMode_on="true"
                android:background="@color/shopbg">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycleview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
            </com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>
Copy the code

The app:tr_pureScrollMode_on= “true” property is the jump bounce without adding any animation. Not adding this property is like PullToRefresh for more loading, but the animation style can be customized

TwinklingRefreshLayout is pulled up to load more custom properties with drop-down refresh

Details: online blog.csdn.net/u014608640/… , www.jianshu.com/p/5ed4813b8… Both of these are very detailed, you can also check out the author’s description on GitHub: github.com/lcodecorex/… All instructions are in Chinese

Custom PullToRefresh implementation of boundback and refresh operations

You can override a PullToRefresh tripartite library, add isElastic to the attr file, and if it’s true it will bounce off bounds. If you don’t set the default it will refresh and load more operations, and of course you can modify the animation

 <com.handmark.pulltorefresh.library.PullToRefreshScrollView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/holo_green_light"
        ptr:ptrMode="both"
        ptr:isElastic="true">
Copy the code