protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_style_classics); mToolbar = FindViewById <Toolbar>(Resource.Id.toolbar); mToolbar.NavigationClick += (sender, e) => { Finish(); }; mRefreshLayout = FindViewById(Resource.Id.refreshLayout) as IRefreshLayout; int deta = new System.Random().Next(7 * 24 * 60 * 60 * 1000); mClassicsHeader = (ClassicsHeader)mRefreshLayout.RefreshHeader; mClassicsHeader.SetLastUpdateTime(new Date(Java.Lang.JavaSystem.CurrentTimeMillis() - deta)); mClassicsHeader.SetTimeFormat(new SimpleDateFormat("更新于 MM-dd HH:mm", Locale.China)); mClassicsHeader.SetTimeFormat(new DynamicTimeFormat("更新于 %s")); var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetItemAnimator(new DefaultItemAnimator()); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); recyclerView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical)); recyclerView.SetAdapter(new CustomBaseRecyclerAdapter(Item.List, Android.Resource.Layout.SimpleListItem2, this)); if (isFirstEnter) { isFirstEnter = false; //触发上啦加载 mRefreshLayout.AutoLoadmore(); //通过多功能监听接口实现 在第一次加载完成之后 自动刷新 mRefreshLayout.SetOnMultiPurposeListener(new CustomSimpleMultiPurposeListener()); } }
public IRefreshHeader CreateRefreshHeader(Context context, IRefreshLayout layout) { ClassicsHeader header = new ClassicsHeader(context).SetSpinnerStyle(SpinnerStyle.FixedBehind); header.SetPrimaryColors(ContextCompat.GetColor(context, Resource.Color.colorPrimary), ContextCompat.GetColor(context, Android.Resource.Color.White)); return(header);//指定为经典Header,默认是 贝塞尔雷达Header }