本文整理汇总了C#中RecyclerView.SetOnScrollListener方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.SetOnScrollListener方法的具体用法?C# RecyclerView.SetOnScrollListener怎么用?C# RecyclerView.SetOnScrollListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.SetOnScrollListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.recyclerview);
recyclerView = FindViewById<RecyclerView> (Resource.Id.recycler_view);
// Layout Managers:
recyclerView.SetLayoutManager (new LinearLayoutManager (this));
// Item Decorator:
recyclerView.AddItemDecoration (new DividerItemDecoration (Resources.GetDrawable (Resource.Drawable.divider)));
recyclerView.SetItemAnimator (new FadeInLeftAnimator ());
// Adapter:
var adapterData = new [] {
"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado",
"Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana",
"Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota",
"Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
"New Hampshire", "New Jersey", "New Mexico", "New York",
"North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon",
"Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington",
"West Virginia", "Wisconsin", "Wyoming"
};
adapter = new RecyclerViewAdapter (this, adapterData.ToList ());
adapter.Mode = Attributes.Mode.Single;
recyclerView.SetAdapter (adapter);
// Listeners
recyclerView.SetOnScrollListener (new ScrollListener ());
}
示例2: AttachToRecyclerView
public void AttachToRecyclerView (RecyclerView recyclerView, IScrollDirectorListener scrollDirectionListener = null, RecyclerView.OnScrollListener onScrollListener = null)
{
var scrollDetector = new RecyclerViewScrollDetectorImpl (this);
scrollDetector.ScrollDirectionListener = scrollDirectionListener;
scrollDetector.OnScrollListener = onScrollListener;
scrollDetector.ScrollThreshold = scrollThreshold;
recyclerView.SetOnScrollListener (scrollDetector);
}
示例3: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var ctx = inflater.Context;
var view = inflater.Inflate (Resource.Layout.RentalsLayout, container, false);
refreshLayout = view.FindViewById<SwipeRefreshLayout> (Resource.Id.refresh_layout);
refreshLayout.SetColorSchemeResources (Resource.Color.swipe_refresh_color_main,
Resource.Color.swipe_refresh_color_shade1,
Resource.Color.swipe_refresh_color_shade2,
Resource.Color.swipe_refresh_color_shade3);
refreshLayout.Refresh += (sender, e) => Refresh (reset: false);
recycler = view.FindViewById<RecyclerView> (Resource.Id.recycler);
layoutManager = new LinearLayoutManager (ctx) {
SmoothScrollbarEnabled = true,
};
recycler.HasFixedSize = true;
recycler.SetLayoutManager (layoutManager);
recycler.SetOnScrollListener (new LoadingScrollListener (this));
loadingLayout = view.FindViewById (Resource.Id.loading_layout);
loginLayout = view.FindViewById (Resource.Id.login_layout);
loginBtn = loginLayout.FindViewById<Button> (Resource.Id.loginBtn);
statusText = loginLayout.FindViewById<TextView> (Resource.Id.loginStatusText);
username = loginLayout.FindViewById<EditText> (Resource.Id.username);
password = loginLayout.FindViewById<EditText> (Resource.Id.password);
SwitchLayoutPhase (LayoutPhase.List);
return view;
}