本文整理汇总了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);
}
示例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;
});
}
示例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);
}