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


C# RecyclerView.SetItemAnimator方法代码示例

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


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

示例1: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.activity_recycler_view_add_remove);
			ActionBar.SetDisplayHomeAsUpEnabled (true);
			ActionBar.SetDisplayShowHomeEnabled (true);
			ActionBar.SetIcon (Android.Resource.Color.Transparent);

			recyclerView = FindViewById<RecyclerView> (Resource.Id.recycler_view);
			recyclerView.HasFixedSize = true;


			layoutManager = new LinearLayoutManager (this);
			recyclerView.SetLayoutManager (layoutManager);

			adapter = new RecyclerAdapter (new List<RecyclerItem>());
			recyclerView.SetAdapter (adapter);
			recyclerView.SetItemAnimator (new DefaultItemAnimator ());

			FindViewById<Button>(Resource.Id.add).Click += (sender, e) => {
				adapter.Add(new RecyclerItem { Title = "New Item: " + adapter.ItemCount });
			};

			adapter.OnItemClick = (view, item) => {
				adapter.Remove(adapter.Items.IndexOf(item));
			};
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:27,代码来源:RecyclerViewActivityAddRemove.cs

示例2: 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 ());
		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:34,代码来源:RecyclerViewExample.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.GraphActivityLayout);

            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar);
            SetSupportActionBar (toolbar);
            SupportActionBar.SetDisplayShowTitleEnabled (false);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);

            graphView = FindViewById<RecyclerView> (Resource.Id.chartView);
            var db = GeofenceDatabase.From (this);
            adapter = new GraphAdapter (db);

            date = DateTime.Now.AddDays (-1);
            var ticks = Intent.GetLongExtra ("dateTime", -1);
            if (ticks != -1)
                date = new DateTime (ticks);
            globalCount = Intent.GetIntExtra ("globalCount", 0);

            adapter.FillUp (EcoPublicApi.CambridgeStation, date);

            graphView.ViewTreeObserver.AddOnGlobalLayoutListener (this);
            graphView.AddItemDecoration (new GraphEntryDecoration ());
            graphView.SetItemAnimator (new GraphEntryAnimator ());

            time = FindViewById<TextView> (Resource.Id.timeText);
            count = FindViewById<TextView> (Resource.Id.countText);
            increment = FindViewById<TextView> (Resource.Id.incrementText);
            meIcon = FindViewById<ImageView> (Resource.Id.meIcon);

            increment.Visibility = ViewStates.Invisible;
            time.Text = date.ToString ("ddd, MMM dd");
            count.Text = globalCount.ToString ();

            adapter.CounterSelected += HandleCounterSelected;

            filterSpinner = FindViewById<Spinner> (Resource.Id.filterSpinner);
        }
开发者ID:garuma,项目名称:Cytotem,代码行数:40,代码来源:GraphActivity.cs

示例4: 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

示例5: OnCreateView

 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     var view = inflater.Inflate(Resource.Layout.CV_Menu, container, false);
     //Create Menu List
     mItemList = new AP_EM_ItemList();
     //Set up layout manager to view all cards on recycler view
     mRecyclerView = view.FindViewById<RecyclerView>(Resource.Id.cv_menurecyclerView);
     mRecyclerView.HasFixedSize = true;
     mLayoutManager = new StaggeredGridLayoutManager(2, 1);
     mRecyclerView.SetLayoutManager(mLayoutManager);
     //Menu List Adapter
     mAdapter = new CVMItemListAdapter(mItemList);
     //Put adapter into RecyclerView
     mRecyclerView.SetAdapter(mAdapter);
     mRecyclerView.SetItemAnimator(new DefaultItemAnimator());
     //Item Click
     mAdapter.ItemClick += OnItemClick;
     return view;
 }
开发者ID:pchmura,项目名称:Munch,代码行数:19,代码来源:CustomerPortal.cs

示例6: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            _photoService = new PhotoService();
            photos = _photoService.GetPhotos();

            #region IsAvialableCamera?

            if (IsThereAnAppToTakePictures())
            {
                CreateDirectoryForPictures();
            }

            #endregion

            #region ResouleViewInitialization

            myRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView);
            //Create layout manager
            //myLayoutManager = new LinearLayoutManager(this);
            mygridLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.Vertical);
            // Attach the layout manager to the recycler view
            myRecyclerView.SetLayoutManager(mygridLayoutManager);
            myAdapter = new RecyclerAdapter(photos);
            myRecyclerView.SetItemAnimator(new DefaultItemAnimator {MoveDuration = 501, AddDuration = 1000});
            myRecyclerView.SetAdapter(myAdapter);

            #endregion
        }
开发者ID:Dneprik,项目名称:AndroidPrivatePhotoLibrary,代码行数:31,代码来源:MainActivity.cs

示例7: OnCreate

        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.CV_Menu);

            #region "logout"
            //logout button
            Button logout = FindViewById<Button>(Resource.Id.menuLogOut);
            logout.Click += (sender, e) => {

                EditText input = new EditText(this);
                RunOnUiThread(() =>
                {
                    AlertDialog.Builder builder;
                    builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Logout?");
                    builder.SetMessage("Enter the password associated with " + LoginScreen.loginUsername + " to logout");
                    builder.SetCancelable(false);
                    builder.SetView(input);
                    builder.SetPositiveButton("OK", delegate {

                        if (input.Text == ("lmo"))
                        {
                            var webClient = new WebClient();
                            Console.WriteLine();
                            webClient.DownloadString("http://54.191.98.63/logout.php?id=" + LoginScreen.loginUsername);
                            this.Finish();
                            SetContentView(Resource.Layout.LoginScreen);
                            Android.Widget.Toast.MakeText(this, "Logged Out Successfully", Android.Widget.ToastLength.Short).Show();
                            StartActivity(typeof(LoginScreen));
                        }
                        else
                        {
                            Android.Widget.Toast.MakeText(this, "Incorrect Password", Android.Widget.ToastLength.Short).Show();
                        }


                    });
                    builder.Show();
                }
                );




                /*
                var webClient = new WebClient();
                Console.WriteLine();
                webClient.DownloadString("http://54.191.98.63/logout.php?id=" + LoginScreen.loginUsername);
                this.Finish();
                SetContentView(Resource.Layout.LoginScreen);
                Android.Widget.Toast.MakeText(this, "Logged Out Successfully", Android.Widget.ToastLength.Short).Show();
                StartActivity(typeof(LoginScreen));
                */
            };
            #endregion

            JsonValue json = await JsonParsing<Task<JsonValue>>.FetchDataAsync(menuURL);
            List<EMItemList> parsedData = JsonParsing<EMItemList>.ParseAndDisplay(json);
            AP_EM_ItemList.mBuiltInCards = parsedData.ToArray();

            //Associations
            mView = FindViewById(Resource.Id.customerspalsh);
            fView = FindViewById(Resource.Id.CV2Menufab);
            headerView = FindViewById(Resource.Id.cv_menuhead);
            frameView = FindViewById(Resource.Id.cv_framerv);

            //FAB
            var fab = FindViewById<FloatingActionButton>(Resource.Id.CV2Menufab);
            FindViewById<FloatingActionButton>(Resource.Id.CV2Menufab).Click += (sender, e) =>
            {
                Hide();
                fab.Visibility = ViewStates.Gone;
            };

            //Create Menu List
            mItemList = new AP_EM_ItemList();
            //Set up layout manager to view all cards on recycler view
            mRecyclerView = FindViewById<RecyclerView>(Resource.Id.cv_menurecyclerView);
            mRecyclerView.HasFixedSize = true;
            mLayoutManager = new StaggeredGridLayoutManager(2, 1);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            //Menu List Adapter
            mAdapter = new CVMItemListAdapter(mItemList);
            //Put adapter into RecyclerView
            mRecyclerView.SetAdapter(mAdapter);
            mRecyclerView.SetItemAnimator(new DefaultItemAnimator());
            //Item Click
            mAdapter.ItemClick += OnItemClick;

            mAdapter.NotifyDataSetChanged();

            Button orderbtn = FindViewById<Button>(Resource.Id.menuorderBtn);
            Button callbtn = FindViewById<Button>(Resource.Id.menuCallWaiter);
            Button pay = FindViewById<Button>(Resource.Id.menupayButton);
            pay.Click += (s, o) =>
            {
                RunOnUiThread(() =>
                {
                    AlertDialog.Builder builder;
//.........这里部分代码省略.........
开发者ID:pchmura,项目名称:Munch,代码行数:101,代码来源:CV2_Menu.cs


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