当前位置: 首页>>代码示例>>C#>>正文


C# RecyclerView.GetLayoutManager方法代码示例

本文整理汇总了C#中RecyclerView.GetLayoutManager方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.GetLayoutManager方法的具体用法?C# RecyclerView.GetLayoutManager怎么用?C# RecyclerView.GetLayoutManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecyclerView的用法示例。


在下文中一共展示了RecyclerView.GetLayoutManager方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnScrolled

        public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
        {
            base.OnScrolled(recyclerView, dx, dy);

            if (!(collection is IIncrementalCollection))
                return;
            
            var layoutManager = recyclerView.GetLayoutManager();
            var lastItem = GetLastVisibleItem(layoutManager);
            if (lastItem + treshold > collection.Count() && dy > 0)
                LoadMore();
        }
开发者ID:akshay2000,项目名称:MonocleGiraffe,代码行数:12,代码来源:ScrollListener.cs

示例2: GetMovementFlags

 public override int GetMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder)
 {
     // Set movement flags based on the layout manager
     if (recyclerView.GetLayoutManager() is GridLayoutManager) {
         int dragFlags = ItemTouchHelper.Up | ItemTouchHelper.Down | ItemTouchHelper.Left | ItemTouchHelper.Right;
         int swipeFlags = 0;
         return MakeMovementFlags(dragFlags, swipeFlags);
     } else {
         int dragFlags = ItemTouchHelper.Up | ItemTouchHelper.Down;
         int swipeFlags = ItemTouchHelper.Start | ItemTouchHelper.End;
         return MakeMovementFlags(dragFlags, swipeFlags);
     }
 }
开发者ID:owuor91,项目名称:XamarinItemTouchHelper,代码行数:13,代码来源:SimpleItemTouchHelperCallback.cs

示例3: OnScrolled

		public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
		{

			base.OnScrolled (recyclerView, dx, dy);

			var visibleItemCount = recyclerView.ChildCount;
			//			Console.Error.WriteLine ("isRefeshing"+MySoal_Tab_1.isRefeshing);
			//
			if (MyHealth_Tab_2.isRefreshing) {
				Console.Error.WriteLine ("masuk");
				MyHealth_Tab_2.worker.CancelAsync ();

				if (MyHealth_Tab_2.worker.CancellationPending) { 
					if (MyHealth_Tab_2.worker.IsBusy == true)
					{

					}				
				}			
			}

			var totalItemCount = recyclerView.GetAdapter().ItemCount;
			var lastVisibleItem = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastCompletelyVisibleItemPosition();

			if ((lastVisibleItem+1) == totalItemCount) {
				Console.Error.WriteLine ("scrolll222");

				LoadMoreEvent (this, null);
			}
		}
开发者ID:kktanpiya,项目名称:pyongPyaa048,代码行数:29,代码来源:Takwim_RecyclerViewAdapter.cs

示例4: GetOrientation

 private int GetOrientation(RecyclerView parent) 
 {
     if (parent.GetLayoutManager() is LinearLayoutManager) {
         LinearLayoutManager layoutManager = (LinearLayoutManager) parent.GetLayoutManager();
         return layoutManager.Orientation;
     } else {
         throw new ArgumentException("DividerItemDecoration can only be used with a LinearLayoutManager.");
     }
 }
开发者ID:fabionuno,项目名称:Timehop.StickyHeadersRecyclerView,代码行数:9,代码来源:DividerDecoration.cs

示例5: OnScrolled

			public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
			{
				base.OnScrolled (recyclerView, dx, dy);

				var visibleItemCount = recyclerView.ChildCount;

				var totalItemCount = recyclerView.GetAdapter().ItemCount;
				var lastVisibleItem = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastCompletelyVisibleItemPosition();

				if ((lastVisibleItem+1) == totalItemCount) {
					LoadMoreEvent (this, null);
				}
			}
开发者ID:kktanpiya,项目名称:kimuraHazuki048,代码行数:13,代码来源:MyVoteMAPOAdapter.cs

示例6: OnScrolled

		public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
		{
			pref = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
			LinearLayoutManager linearLayoutManager = (LinearLayoutManager)recyclerView.GetLayoutManager ();
			int lastVisibleItem = linearLayoutManager.FindLastVisibleItemPosition();
			int totalItemCount = recyclerView.GetAdapter().ItemCount;

			if (!IsLoading && totalItemCount <= (lastVisibleItem + visibleThreshold)) {
				// End has been reached
				// Do something
				var currPrefPage = pref.GetString ("CurrentPage", string.Empty);
				if (!String.IsNullOrEmpty (currPrefPage)) {
					if (Int32.Parse (currPrefPage) > 0) {
						currentPage++;
					} else {
						currentPage = 2;
					}
				} else {
					currentPage++;

				}
				var editor = pref.Edit();
				editor.PutString("CurrentPage",currentPage.ToString());
				editor.Apply();

				IsLoading = true;
				Task.Factory.StartNew (async () => {
					
					try{
						var newPostList = new List<Post>();
						await WebClient.LoadPosts(newPostList,currentPage);


						(recyclerView.GetAdapter()as PostViewAdapter)._Posts.AddRange(newPostList);
						//recyclerView.GetAdapter().HasStableIds = true;

						_messageShown = false;
						Application.SynchronizationContext.Post (_ => {recyclerView.GetAdapter().NotifyDataSetChanged();}, null);
						//recyclerView.GetAdapter().NotifyItemRangeInserted(recyclerView.GetAdapter().ItemCount,newPostList.Count);
					}catch(Exception ex){
						//Insights.Report(ex,new Dictionary<string,string>{{"Message",ex.Message}},Insights.Severity.Error);
						var text = ex.Message;
						if(!_messageShown){
							Application.SynchronizationContext.Post (_ => {
								Toast.MakeText(Application.Context,"При загрузке данных произошла ошибка",ToastLength.Short).Show();
							}, null);
							_messageShown = true;
						}

					}


					IsLoading = false;
				});

			}
		}
开发者ID:takigava,项目名称:pikabu,代码行数:57,代码来源:PostViewAdapter.cs

示例7: GetItemOffsets

			public override void GetItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
			{
				base.GetItemOffsets(outRect, view, parent, state);

				var layoutManager = (StaggeredGridLayoutManager)parent.GetLayoutManager();
				int position = parent.GetChildAdapterPosition(view);
				if (position < layoutManager.SpanCount)
				{
					outRect.Top = headerView.heightHeader;
				}
			}
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:11,代码来源:StickyHeaderRecyclerView.cs

示例8: CanRecyclerViewScroll

        public static bool CanRecyclerViewScroll(RecyclerView view)
        {
            if (view == null || view.GetAdapter() == null || view.GetLayoutManager() == null)
                return false;
            RecyclerView.LayoutManager lm = view.GetLayoutManager();
            int count = view.GetAdapter().ItemCount;
            int lastVisible;

            if (lm is LinearLayoutManager)
            {
                LinearLayoutManager llm = (LinearLayoutManager)lm;
                lastVisible = llm.FindLastVisibleItemPosition();
            }
            else
            {
                throw new InvalidOperationException("Material Dialogs currently only supports LinearLayoutManager. Please report any new layout managers.");
            }

            if (lastVisible == -1)
                return false;

            bool lastItemVisible = lastVisible == count - 1;
            return !lastItemVisible ||
                    (view.ChildCount > 0 && view.GetChildAt(view.ChildCount - 1).Bottom > view.Height - view.PaddingBottom);
        }
开发者ID:devxiaruwei,项目名称:MaterialDialogs,代码行数:25,代码来源:MDRootLayout.cs

示例9: GetOrientation

		private int GetOrientation (RecyclerView parent)
		{
			var layoutManager = parent.GetLayoutManager () as LinearLayoutManager;
			if (layoutManager != null) {
				return layoutManager.Orientation;
			} else {
				throw new ArgumentException ("DividerItemDecoration can only be used with a LinearLayoutManager.");
			}
		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:9,代码来源:DividerItemDecoration.cs

示例10: OnScrolled

 public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
 {
     var mLayoutManager = (PreCachingLayoutManager)recyclerView.GetLayoutManager();
     if (dy > 0) //check for scroll down
     {
         visibleItemCount = mLayoutManager.ChildCount;
         totalItemCount = mLayoutManager.ItemCount;
         pastVisiblesItems = mLayoutManager.FindFirstVisibleItemPosition();
         if (mFragment.detecting)
         {
             if ((visibleItemCount + pastVisiblesItems) >= (totalItemCount - offset))
             {
                 mFragment.detecting = false;
                 Console.WriteLine("Loading page " + (mFragment.page + 1));
                 mFragment.refresher.Refreshing = true;
                 mFragment.addPosts(mFragment.site + "feed/?paged=" + (mFragment.page + 1), false);
             }
         }
     }
 }
开发者ID:YoDevil,项目名称:SmartReport,代码行数:20,代码来源:RecensioniFragment.cs


注:本文中的RecyclerView.GetLayoutManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。