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


C# RecyclerView.ScrollToPosition方法代码示例

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


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

示例1: OnViewCreated

		public override void OnViewCreated (View rootView, Bundle savedInstanceState)
		{
			base.OnViewCreated (rootView, savedInstanceState);
			mLayoutManager = new LinearLayoutManager (Activity);
			mUsageListAdapter = new UsageListAdapter ();
			mRecyclerView = rootView.FindViewById<RecyclerView> (Resource.Id.recyclerview_app_usage);
			mRecyclerView.SetLayoutManager (mLayoutManager);
			mRecyclerView.ScrollToPosition (0);
			mRecyclerView.SetAdapter (mUsageListAdapter);
			mOpenUsageSettingButton = rootView.FindViewById<Button> (Resource.Id.button_open_usage_setting);
			mSpinner = rootView.FindViewById<Spinner> (Resource.Id.spinner_time_span);
			var spinnerAdapter = ArrayAdapter.CreateFromResource (Activity,
				                     Resource.Array.action_list, Android.Resource.Layout.SimpleSpinnerDropDownItem);
			mSpinner.Adapter = spinnerAdapter;
			mSpinner.OnItemSelectedListener = new MyOnItemSelectedListener (this);
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:16,代码来源:AppUsageStatisticsFragment.cs

示例2: BlotterRowAdapter

        public BlotterRowAdapter(RecyclerView recyclerView, ObservableCollection<ITradeViewModel> tradesCollection)
        {
            _tradesCollection = tradesCollection;
            
            var animator = new BlotterRowAnimator();
            recyclerView.SetItemAnimator(animator);

            _tradesCollection = tradesCollection;
            _collectionChangedSubscription = _tradesCollection.ObserveCollection()
                .Subscribe(changeArgs =>
                {
                    if (_animationsEnabled && changeArgs.Action == NotifyCollectionChangedAction.Add && changeArgs.NewItems.Count == 1)
                    {
                        Console.WriteLine($"Count: {_tradesCollection.Count}");
                        NotifyItemInserted(changeArgs.NewStartingIndex);
                        recyclerView.SmoothScrollToPosition(0);
                    }
                    else
                    {
                        NotifyDataSetChanged();

                        if (!_animationsEnabled)
                        {
                            recyclerView.ScrollToPosition(0);
                        }
                    }
                });

            _tradesCollection.ObserveCollection()
                .FirstAsync()
                .Delay(TimeSpan.FromSeconds(1))
                .Subscribe(_ =>
                {
                    _animationsEnabled = true;
                });
        }
开发者ID:tomgilder,项目名称:ReactiveTrader,代码行数:36,代码来源:BlotterRowAdapter.cs

示例3: OnViewCreated

		public override void OnViewCreated (View rootView, Bundle savedInstanceState)
		{
			base.OnViewCreated (rootView, savedInstanceState);

			var openDir = rootView.FindViewById (Resource.Id.button_open_directory);
			openDir.Click += (sender, e) => {
				Intent intent = new Intent (Intent.ActionOpenDocumentTree);
				StartActivityForResult (intent, REQUEST_CODE_OPEN_DIRECTORY);
			};

			mCurrentDirectoryTextView = (TextView)rootView
				.FindViewById (Resource.Id.textview_current_directory);
			mCreateDirectoryButton = (Button)rootView.FindViewById (Resource.Id.button_create_directory);

			mCreateDirectoryButton.Click += (sender, e) => {
				EditText editView = new EditText (Activity);
				var builder = new AlertDialog.Builder (Activity)
					.SetTitle (Resource.String.create_directory)
					.SetView (editView)
					.SetPositiveButton (Resource.String.ok, delegate {
					CreateDirectory (mCurrentDirectoryUri,
						editView.Text);
					UpdateDirectoryEntries (mCurrentDirectoryUri);
				})
					.SetNegativeButton (Resource.String.cancel, delegate {
				});
				builder.Show ();
			};

			mRecyclerView = rootView.FindViewById<RecyclerView> (Resource.Id.recyclerview_directory_entries);
			mLayoutManager = new LinearLayoutManager (Activity);
			mRecyclerView.SetLayoutManager (mLayoutManager);
			mRecyclerView.ScrollToPosition (0);
			mAdapter = new DirectoryEntryAdapter (new List<DirectoryEntry> ());
			mRecyclerView.SetAdapter (mAdapter);
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:36,代码来源:DirectorySelectionFragment.cs


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