多种下拉刷新效果、上拉加载更多、可配置自定义头部广告位
开发者使用 BGARefreshLayout-Android 可以对各种控件实现多种下拉刷新效果、上拉加载更多以及配置自定义头部广告位
测试 BGARefreshLayout 与 Activity、Fragment、ViewPager 的各种嵌套的 Demo
1.BGARefreshLayout 的直接子控件的高度请使用 android:layout_height="0dp" 和 android:layout_weight="1"
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_modulename_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<AnyView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
2.如果是在 Fragment 中使用 BGARefreshLayout
请在 onCreateView 方法中初始化 BGARefreshLayout,不要在 onActivityCreated 方法中初始化
开发者也可以继承 BGARefreshViewHolder 这个抽象类,实现相应地抽象方法做出格式各样的下拉刷新效果【例如实现 handleScale(float scale, int moveYDistance) 方法,根据 scale 实现各种下拉刷新动画】和上拉加载更多特效,可参考 BGAMoocStyleRefreshViewHolder、BGANormalRefreshViewHolder、BGAStickinessRefreshViewHolder、BGAMeiTuanRefreshViewHolder 的实现方式。
maven { url 'https://jitpack.io' } 添加到 root build.gradle 的 repositories 中dependencies {
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.bingoogolapple:BGARefreshLayout-Android:latestVersion'
}
注意:内容控件的高度请使用 android:layout_height="0dp" 和 android:layout_weight="1"
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_modulename_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<AnyView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
…
如果您觉得 BGA 系列开源库或工具软件帮您节省了大量的开发时间,可以扫描下方的二维码打赏支持。您的支持将鼓励我继续创作,打赏后还可以加我微信免费开通一年 上帝小助手浏览器扩展/插件开发平台 的会员服务
微信 QQ 支付宝Copyright 2015 bingoogolapple
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.
No open issues yet, or sync has not completed.