protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Activity_RecyclerView); _recyclerView = (RecyclerView)FindViewById(Resource.Id.recycler_view); _linearLayoutManager = new LinearLayoutManager(this); _recyclerView.SetLayoutManager(_linearLayoutManager); _myRecyclerAdapter = new RecyclerAdapter(this, _dataList); _recyclerView.SetAdapter(_myRecyclerAdapter); _swipeRefreshLayout = FindViewById <Views.SuperSwipeRefreshLayout>(Resource.Id.Swipe_Refresh); _swipeRefreshLayout.SetHeaderView(CreateHeaderView()); _swipeRefreshLayout.SetFooterView(CreateFooterView()); _swipeRefreshLayout.SetTargetScrollWithLayout(true); _swipeRefreshLayout.SetOnPullRefreshListener(new MyOnPullRefreshListener(this)); _swipeRefreshLayout.SetOnPushLoadMoreListener(new MyOnPushLoadMoreListener(this)); BuildDatas(); _myRecyclerAdapter.NotifyDataSetChanged(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Activity_ListView); _listView = FindViewById <ListView>(Resource.Id.List_View); _listView.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, GetData()); _swipeRefreshLayout = FindViewById <SuperSwipeRefreshLayout>(Resource.Id.Swipe_Refresh); _swipeRefreshLayout.SetOnPullRefreshListener(new MyOnPullRefreshListener(this)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Activity_ScrollView); _swipeRefreshLayout = (SuperSwipeRefreshLayout)FindViewById(Resource.Id.Swipe_Refresh); View child = LayoutInflater.From(_swipeRefreshLayout.Context).Inflate(Resource.Layout.layout_head, null); _progressBar = (ProgressBar)child.FindViewById(Resource.Id.pb_view); _textView = (TextView)child.FindViewById(Resource.Id.text_view); _textView.Text = "下拉更新"; _imageView = (ImageView)child.FindViewById(Resource.Id.image_view); _imageView.Visibility = ViewStates.Visible; _imageView.SetImageResource(Resource.Drawable.down_arrow); _progressBar.Visibility = ViewStates.Gone; _swipeRefreshLayout.SetHeaderView(child); _swipeRefreshLayout.SetOnPullRefreshListener(new MyOnPullRefreshListener(this)); }