pull to make soup
1.0.0
自訂動畫拉動刷新,可以輕鬆添加到 RecyclerView
受到這個運球項目的啟發
最低 SDK 版本 16
在您的專案等級 build.gradle 中
allprojects {
repositories {
.. .
maven { url ' https://jitpack.io ' }
}
}
在您的應用程式層級 build.gradle 中
compile ' com.github.Yalantis:pull-to-make-soup:1.0.2 '
將該庫包含為本地庫項目。
其次,將 PullToRefreshView 新增到您的佈局中,並使用 app:type="soup"
< com .yalantis.pulltomakesoup.PullToRefreshView
android : id = " @+id/pull_to_refresh "
app : type = " soup "
android : layout_width = " match_parent "
android : layout_height = " match_parent " >
< android .support.v7.widget.RecyclerView
android : id = " @+id/recycler_view "
android : layout_width = " match_parent "
android : layout_height = " match_parent "
android : divider = " @null "
android : dividerHeight = " 0dp "
android : fadingEdge = " none " />
</ com .yalantis.pulltomakesoup.PullToRefreshView>
接下來在 onCreate 方法中引用 View 並設定 OnRefreshListener。
mPullToRefreshView = ( PullToRefreshView ) findViewById ( R . id . pull_to_refresh );
mPullToRefreshView . setOnRefreshListener ( new PullToRefreshView . OnRefreshListener () {
@ Override
public void onRefresh () {}
});
當您需要完成令人耳目一新的通話時
mPullToRefreshView . setRefreshing ( false );
如果您需要更改進度狀態:
mPullToRefreshView . setRefreshing ( boolean isRefreshing )
如果您向我們發送使用我們組件的項目的鏈接,我們將非常高興。只需發送電子郵件至 [email protected] 如果您對動畫有任何疑問或建議,請告訴我們。
PS 我們將發布更多包含在程式碼中的精彩內容以及關於如何讓 Android (iOS) 的 UI 變得更好的教學。敬請關注!
Copyright 2017, Yalantis
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.