本文整理汇总了C#中RecyclerView.AddOnScrollListener方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.AddOnScrollListener方法的具体用法?C# RecyclerView.AddOnScrollListener怎么用?C# RecyclerView.AddOnScrollListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.AddOnScrollListener方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StickyHeaderRecyclerView
public StickyHeaderRecyclerView(Context context, View header, int minHeightHeader, HeaderAnimator headerAnimator, RecyclerView recyclerView, bool preventTouchBehindHeader)
: base(context, header, recyclerView, minHeightHeader, headerAnimator, preventTouchBehindHeader)
{
SetupItemDecorator();
// scroll events
recyclerView.AddOnScrollListener(new RecyclerScrollListener(this));
}
示例2: OnCreate
protected async override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.MyShop_listall_fragment_list);
var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar);
SetSupportActionBar (toolbar);
toolbar.SetBackgroundColor (Color.ParseColor ("#9C27B0"));
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
SupportActionBar.SetDisplayShowHomeEnabled (true);
mRecyclerView = FindViewById <RecyclerView> (Resource.Id.recyclerView);
progressBar = FindViewById <ProgressBar> (Resource.Id.pbHeaderProgress);
llMyShopErrorLayout = (LinearLayout)FindViewById (Resource.Id.llMyShopErrorLayout);
currentPage = 1;
string action_type = Intent.GetStringExtra ("action_type");
//run setupdata and get title e.g:search,latest product etc
var title = await Task.Factory.StartNew(() => setupData(currentPage , action_type));
Title = title;
if (mRecyclerView != null) {
mRecyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (this);
var onScrollListener = new Product_RecyclerViewAdapter.ViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
currentPage++;
if (currentPage <= lastPage) {
ThreadPool.QueueUserWorkItem (o => { setupData (currentPage , action_type); });
}
};
mRecyclerView.AddOnScrollListener (onScrollListener);
mRecyclerView.SetLayoutManager (layoutManager);
}
// var fab = FindViewById<FloatingActionButton> (Resource.Id.fab);
// fab.Click += (sender, e) => {
// Snackbar.Make (fab, "Here's a snackbar!", Snackbar.LengthLong).SetAction ("Action",
// new ClickListener (v => {
// Console.WriteLine ("Action handler");
// })).Show ();
//
//
// };
}
示例3: ItemTouchListener
public ItemTouchListener (RecyclerView recyclerView, IItemTouchListener listener)
{
if (recyclerView == null || listener == null) {
throw new IllegalArgumentException ("RecyclerView and Listener arguments can not be null");
}
IsScrolling = false;
this.recyclerView = recyclerView;
this.listener = listener;
gestureDetector = new GestureDetector (recyclerView.Context, this);
recyclerView.AddOnScrollListener (new RecyclerViewScrollDetector (this));
}
示例4: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.MyVote_Main);
progressDialog = ProgressDialog.Show (this, "Sila Tunggu", "Sedang Memuatkan...");
//initiliaze jsonvalue
// MyVote_Data myVoteData = new MyVote_Data();
mRecyclerView = FindViewById <RecyclerView> (Resource.Id.recyclerView);
var toolbar = FindViewById <Toolbar> (Resource.Id.toolbar);
SetSupportActionBar (toolbar);
var mLayoutManager = new LinearLayoutManager (this);
mRecyclerView.SetLayoutManager (mLayoutManager);
//error layout
llMyPosterErrorLayout = (LinearLayout)FindViewById (Resource.Id.llMyPosterErrorLayout);
tvMyPosterErrorLayout = (TextView)FindViewById (Resource.Id.tvMyPosterErrorLayout);
setupMyVoteData (page);
if (mRecyclerView != null ) {
mRecyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (this);
var onScrollListener = new MyVote.MyVoteMAPOAdapter.MyvoteRecyclerViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
page++;
lastPage=MyVote_Data.getLastPage ();
if (page <= lastPage && isRefeshing == false) {
ThreadPool.QueueUserWorkItem (o => {
setupMyVoteData (page);
});
}
};
mRecyclerView.AddOnScrollListener (onScrollListener);
mRecyclerView.SetLayoutManager (layoutManager);
}
}
示例5: OnCreateView
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState)
{
View v = inflater.Inflate(Resource.Layout.MyHealth_tab_1 ,container ,false);
//TextView tvText = v.FindViewById<TextView> (Resource.Id.textView);
recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView);
progressDialog = ProgressDialog.Show (Activity, "Sila Tunggu", "Sedang Memuatkan...");
llMHeT1ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMHeT1ErrorLayout);
tvMHeT1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMHeT1ErrorStatus);
tvMHeT1ErrorStatus.Text = "Sedang memeriksa data...";
mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout);
mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight);
mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh;
if (recyclerView != null) {
recyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (Activity);
var onScrollListener = new MyHealthRecyclerViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
page++;
if (page <= lastPage && isRefreshing == false) {
ThreadPool.QueueUserWorkItem (o => {
setupMyHealthData (page);
});
}
};
recyclerView.AddOnScrollListener (onScrollListener);
recyclerView.SetLayoutManager (layoutManager);
}
return v;
}
示例6: OnCreateView
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState)
{
View v = inflater.Inflate(Resource.Layout.MySoal_tab_1 ,container ,false);
//TextView tvText = v.FindViewById<TextView> (Resource.Id.textView);
recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView);
llMST1ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMST1ErrorLayout);
tvMST1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMST1ErrorStatus);
footerViewUL = ((LayoutInflater)Activity.GetSystemService (Context.LayoutInflaterService)).Inflate (Resource.Layout.MySoal_ReadMoreLayout, null, false);
mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout);
mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight);
mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh;
if (recyclerView != null) {
recyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (Activity);
var onScrollListener = new MySoalRecyclerViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
Console.Error.WriteLine ("isRefeshing" + isRefreshing);
page++;
if (page <= lastPage && isRefreshing == false) {
Console.Error.WriteLine ("masuk");
ThreadPool.QueueUserWorkItem (o => {
InitialProgress (page);
});
}
};
recyclerView.AddOnScrollListener (onScrollListener);
recyclerView.SetLayoutManager (layoutManager);
}
return v;
}
示例7: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
var view = inflater.Inflate(Resource.Layout.fragment_past_trips, null);
viewModel = new PastTripsViewModel();
recyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView);
refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
refresher.Refresh += (sender, e) => viewModel.LoadPastTripsCommand.Execute(null);
adapter = new TripAdapter(Activity, viewModel);
adapter.ItemClick += OnItemClick;
adapter.ItemLongClick += OnItemLongClick;
layoutManager = new LinearLayoutManager(Activity) {Orientation = LinearLayoutManager.Vertical};
recyclerView.SetLayoutManager(layoutManager);
recyclerView.SetAdapter(adapter);
recyclerView.ClearOnScrollListeners();
recyclerView.AddOnScrollListener(new TripsOnScrollListenerListener(viewModel, layoutManager));
return view;
}
示例8: OnCreateView
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState)
{
tokenData = Activity.Intent.GetStringExtra ("Token");
View v = inflater.Inflate(Resource.Layout.MyKomuniti_tab_1 ,container ,false);
//TextView tvText = v.FindViewById<TextView> (Resource.Id.textView);
recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView);
progressDialog = ProgressDialog.Show (Activity, "Sila Tunggu", "Sedang Memuatkan...");
llMKkT1ErrorStatus = (LinearLayout)v.FindViewById (Resource.Id.llMKkT1ErrorStatus);
tvMKkT1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMKkT1ErrorStatus);
mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout);
mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight);
mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh;
if (recyclerView != null) {
recyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (Activity);
var onScrollListener = new MyKomunitiRecyclerViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
Console.Error.WriteLine ("isRefeshing" + isRefreshing);
page++;
if (page <= lastPage && isRefreshing == false) {
Console.Error.WriteLine ("masuk");
ThreadPool.QueueUserWorkItem (o => {
InitialSetup (tokenData, page);
});
}
};
recyclerView.AddOnScrollListener (onScrollListener);
recyclerView.SetLayoutManager (layoutManager);
}
return v;
}
示例9: RegisterRecyclerView
//region register scrollables
/**
* Register a RecyclerView to the current MaterialViewPagerAnimator
* Listen to RecyclerView.OnScrollListener so give to $[onScrollListener] your RecyclerView.OnScrollListener if you already use one
* For loadmore or anything else
*
* @param recyclerView the scrollable
* @param onScrollListener use it if you want to get a callback of the RecyclerView
*/
public void RegisterRecyclerView(RecyclerView recyclerView, RecyclerView.OnScrollListener onScrollListener)
{
if (recyclerView != null)
{
ScrollViewList.Add(recyclerView); //add to the scrollable list
YOffsets.AddOrUpdate(recyclerView, recyclerView.ScrollY); //save the initial recyclerview's yOffset (0) into hashmap
//only necessary for recyclerview
//listen to scroll
recyclerView.AddOnScrollListener(new RecyclerViewScrollListener(this, onScrollListener));
recyclerView.Post(() => SetScrollOffset(recyclerView, LastYOffset));
}
}
示例10: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
var rootView = inflater.Inflate(Resource.Layout.list_fragment, container, false);
pbNews = rootView.FindViewById<RelativeLayout>(Resource.Id.pbNews);
listViewNews = rootView.FindViewById<RecyclerView>(Resource.Id.list_news);
emptyView = rootView.FindViewById<TextView>(Resource.Id.empty_view);
PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(Application.Context);
mLayoutManager.Orientation = LinearLayoutManager.Vertical;
mLayoutManager.SetExtraLayoutSpace(GetScreenHeight(Activity));
listViewNews.SetLayoutManager(mLayoutManager);
listViewNews.SetLayoutManager(mLayoutManager);
listViewNews.AddOnScrollListener(new mOnScrollListener(this));
refresher = rootView.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
refresher.SetColorSchemeResources(Resource.Color.orange, Resource.Color.green, Resource.Color.blue);
refresher.Refresh+= (sender, e) => {
pbNews.Visibility = ViewStates.Visible;
load(site + "feed", true);
page = 1;
detecting = true;
};
load (site+"feed",false);
return rootView;
}
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState)
{
View v = inflater.Inflate(Resource.Layout.MyHealth_tab_2 ,container ,false);
recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerViewTakwim);
//mListView = v.FindViewById <ListView> (Resource.Id.listViewContainer);
//mListView = v.FindViewById <ListView> (Android.Resource.Id.List);
llMHeT2ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMHeT2ErrorLayout);
tvMHeT2ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMHeT2ErrorStatus);
mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout);
mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight);
mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh;
if (recyclerView != null) {
recyclerView.HasFixedSize = true;
var layoutManager = new LinearLayoutManager (Activity);
var onScrollListener = new MyHealthBWRecyclerViewOnScrollListener (layoutManager);
onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
Console.Error.WriteLine ("isRefeshing" + isRefreshing);
page++;
if (page <= lastPage && isRefreshing == false) {
Console.Error.WriteLine ("masuk");
ThreadPool.QueueUserWorkItem (o => {
setupMyHealthData (page);
});
}
};
recyclerView.AddOnScrollListener (onScrollListener);
recyclerView.SetLayoutManager (layoutManager);
}
return v;
}
示例12: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (Arguments != null)
{
site = Arguments.GetString("baseUrl", "http://smartreporter.altervista.org/");
}
searching = false;
loadedSite = "http://smartreporter.altervista.org/";
var rootView = inflater.Inflate(Resource.Layout.list_fragment, container, false);
if (savedInstanceState != null)
{
IParcelable savedRecyclerLayoutState = (IParcelable)savedInstanceState.GetParcelable("recycler_layout");
listViewNews.GetLayoutManager().OnRestoreInstanceState(savedRecyclerLayoutState);
}
pbNews = rootView.FindViewById<RelativeLayout>(Resource.Id.pbNews);
listViewNews = rootView.FindViewById<RecyclerView>(Resource.Id.list_news);
emptyView = rootView.FindViewById<TextView>(Resource.Id.empty_view);
//Setup layout manager
PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(Application.Context);
mLayoutManager.Orientation = LinearLayoutManager.Vertical;
mLayoutManager.SetExtraLayoutSpace(GetScreenHeight(Activity));
listViewNews.SetLayoutManager(mLayoutManager);
listViewNews.AddOnScrollListener(new mOnScrollListener(this));
refresher = rootView.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
refresher.SetColorSchemeResources(Resource.Color.orange, Resource.Color.green, Resource.Color.blue);
refresher.Refresh += (sender, e) =>
{
pbNews.Visibility = ViewStates.Visible;
load(site + "feed", true);
page = 1;
detecting = true;
};
load(site + "feed", false);
return rootView;
}