首页 > 代码库 > 谷歌官方组件SwipeRefreshLayout实现下拉刷新(简洁)
谷歌官方组件SwipeRefreshLayout实现下拉刷新(简洁)
布局文件:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/srl_refresh" android:layout_above="@id/rl_send" style="@style/Rosemary.Plane"> <ScrollView android:id="@+id/sl_part" style="@style/BaseStyle.ScrollView"> <RelativeLayout android:paddingBottom="@dimen/margin_standard" android:layout_width="match_parent" android:layout_height="match_parent"> <!--订单信息--> <RelativeLayout android:id="@+id/part_top" style="@style/BaseStyle.FullWrap" android:layout_alignParentTop="true" android:background="@color/gray_standard" android:padding="@dimen/margin_standard"> <ImageView android:id="@+id/icon" style="@style/BaseStyle.View" android:layout_marginTop="@dimen/margin_small" android:src=http://www.mamicode.com/"@drawable/window"/>>主页面代码:
import android.support.v4.widget.SwipeRefreshLayout; public class SaleOrderDetailActivity extends Activity implements SwipeRefreshListener,{ private SwipeRefreshLayout mSwipeRefreshLayout;//下拉刷新组件 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.order_sale_detail_layout); mSwipeRefreshLayout = $(R.id.srl_refresh); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.background_blue_standard, R.color.white, R.color.background_blue_standard, R.color.white);//设置颜色 } @Override public void onRefresh() {//下拉监听 //刷新处理 } }
谷歌官方组件SwipeRefreshLayout实现下拉刷新(简洁)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。