• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RecyclerView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.StudyCardLayout, container, false);
            mRecyclerView = view.FindViewById<RecyclerView> (Resource.Id.recyclerView);
            //mListView = view.FindViewById<ListView> (Resource.Id.lvToDoList);
            mFab = view.FindViewById<FloatingActionButton> (Resource.Id.fab);
            mFab.Click += (sender, e) => {
                createFragment(null,true);
            };
            mStudyGroup = new List<StudyGroup> ();
            StudyRequest asyncStudyRquest = new StudyRequest ();
            Task<StudyResponse> data = asyncStudyRquest.StudyRequestAsync (LoginInfo.username, LoginInfo.KEY);

            StudyResponse results = data.Result;
            List<StudyGroup> resultsList = new List<StudyGroup> (results.studyGroups);

            for (int i = 0; i <resultsList.Count; i++) {

                mStudyGroup.Add (resultsList[i]);
            }

            mLayoutManager = new LinearLayoutManager (view.Context);
            mRecyclerView.SetLayoutManager (mLayoutManager);
            mAdapter = new RecyclerAdapter (mStudyGroup,mRecyclerView,this);
            mRecyclerView.SetAdapter (mAdapter);

            return view;
        }
开发者ID:ScholarStation,项目名称:Android,代码行数:28,代码来源:StudyCardFrag.cs


示例2: OnBindViewHolder

 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     var movieViewHolder = (MovieViewHolder)holder;
     movieViewHolder.MovieNameTextView.Text = movies[position].title;
     movieViewHolder.DirectedByTextView.Text = "Directed by " + movies[position].director;
     movieViewHolder.ReleasedOnTextView.Text = "Released on " + movies[position].release_date;
 }
开发者ID:vkoppaka,项目名称:31DaysOfXamarinAndroid,代码行数:7,代码来源:MovieAdapter.cs


示例3: OnBindViewHolder

		public override void OnBindViewHolder (RecyclerView.ViewHolder viewHolder, int position)
		{
			var item = items [position];
			var holder = viewHolder as MyViewHolder2;
			holder.imageView.SetBackgroundResource (items[position]);

		}
开发者ID:kamalthakur2305,项目名称:Xamarin-Multiple-RecyclerView,代码行数:7,代码来源:MyAdapter2.cs


示例4: OnCreateView

        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.ProjectListFragment, container, false);

            recyclerView = view.FindViewById<RecyclerView> (Resource.Id.ProjectListRecyclerView);
            recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
            recyclerView.AddItemDecoration (new ShadowItemDecoration (Activity));
            recyclerView.AddItemDecoration (new DividerItemDecoration (Activity, DividerItemDecoration.VerticalList));

            emptyStateLayout = view.FindViewById<LinearLayout> (Resource.Id.ProjectListEmptyState);
            searchEmptyState = view.FindViewById<LinearLayout> (Resource.Id.ProjectListSearchEmptyState);
            tabLayout = view.FindViewById<TabLayout> (Resource.Id.WorkspaceTabLayout);
            newProjectFab = view.FindViewById<AddProjectFab> (Resource.Id.AddNewProjectFAB);
            toolBar = view.FindViewById<Toolbar> (Resource.Id.ProjectListToolbar);

            var activity = (Activity)Activity;
            activity.SetSupportActionBar (toolBar);
            activity.SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            activity.SupportActionBar.SetTitle (Resource.String.ChooseTimeEntryProjectDialogTitle);

            HasOptionsMenu = true;
            newProjectFab.Click += OnNewProjectFabClick;
            tabLayout.SetOnTabSelectedListener (this);

            return view;
        }
开发者ID:alfonsogarciacaro,项目名称:mobile,代码行数:26,代码来源:ProjectListFragment.cs


示例5: OnCreate

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

            recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView);
            activityIndicator = FindViewById<ProgressBar>(Resource.Id.activityIndicator);

            activityIndicator.Visibility = Android.Views.ViewStates.Visible;

            layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);

            recyclerView.SetLayoutManager(layoutManager);

            var repository = new MoviesRepository();

            var films = await repository.GetAllFilms();

            var moviesAdapter = new MovieAdapter(films.results);

            recyclerView.SetAdapter(moviesAdapter);

            activityIndicator.Visibility = Android.Views.ViewStates.Gone;

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
开发者ID:vkoppaka,项目名称:31DaysOfXamarinAndroid,代码行数:26,代码来源:MainActivity.cs


示例6: GetSwipeDirs

 public override int GetSwipeDirs (RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder)
 {
     if (listener.CanDismiss (recyclerView, viewHolder)) {
         return ItemTouchHelper.Right;
     }
     return 0;
 }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:7,代码来源:SwipeDismissCallback.cs


示例7: OnInterceptTouchEvent

        public bool OnInterceptTouchEvent (RecyclerView rv, MotionEvent e)
        {
            // TODO : this part intercep any touch inside recycler
            // and delete pending items.
            // A better method could be used.

            if (e.Action == MotionEventActions.Down) {
                var undoAdapter = (IUndoAdapter)rv.GetAdapter ();
                View view = GetChildViewUnder (e);

                if (view == null) {
                    undoAdapter.DeleteSelectedItem ();
                } else {
                    int position = recyclerView.GetChildLayoutPosition (view);
                    if (!undoAdapter.IsUndo (position)) {
                        undoAdapter.DeleteSelectedItem ();
                    }
                }
            }

            if (IsEnabled) {
                gestureDetector.OnTouchEvent (e);
            }
            return false;
        }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:25,代码来源:ItemTouchListener.cs


示例8: MovieCategoryViewHolder

		public MovieCategoryViewHolder (View itemView, int viewType) : base (itemView) {
			//Creates and caches our views defined in our layout
			if (viewType == 0) // TODO: Calculate this. I don't think this is a good way to ensure consistent presentation across different device resolutions
				itemView.SetPadding (itemView.PaddingLeft, itemView.PaddingTop + 110, itemView.PaddingRight, itemView.PaddingBottom);
			this.CategoryName = itemView.FindViewById<TextView>(Resource.Id.movie_category_item_txtCategoryName);
			this.MovieList = itemView.FindViewById<RecyclerView>(Resource.Id.movie_category_item_lstMovies);
		}
开发者ID:Robert-Altland,项目名称:MovieExplorer,代码行数:7,代码来源:MovieCategoryViewHolder.cs


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


示例10: OnCreate

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

            _persoon = Gegevens.GetPerson();
            _groep = Gegevens.CurrentGroup();

            SetContentView(Resource.Layout.Betaalscherm);

            _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            ImageView Avatar = _toolbar.FindViewById<ImageView>(Resource.Id.Avatar);
            TextView Title = _toolbar.FindViewById<TextView>(Resource.Id.Title);
            Title.Text = _groep.groepsnaam;

            foreach (var lid in _persoon.KrijgSchuldGroep(_groep))
            {
                deelnemers.Add(new ListItem(lid.Key, Resource.Drawable.iconn, lid.Value, _groep));
            }

            _adapter = new ListItemAdapter(ListItem.Session, deelnemers);
            _adapter.ItemClick += OnItemClick;
            _adapter.ItemLongClick += (sender, e) => {};

            _recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerview);
            _recyclerView.SetMinimumHeight(ConvertDptoPx(listItemHeight*deelnemers.Count));
            _recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            _recyclerView.SetScrollContainer(true);
            _recyclerView.NestedScrollingEnabled = false;
            _recyclerView.SetAdapter(_adapter);

            SetSupportActionBar(_toolbar);
            SupportActionBar.Title = "";
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
        }
开发者ID:SansSkill,项目名称:Introproject,代码行数:35,代码来源:Betaalscherm.cs


示例11: OnBindViewHolder

		public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
		{
			//int item = mData[position];
			//IWindowManager windowManager = context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();
			//MyKomuniti_ViewHolder vh = holder as MyKomuniti_ViewHolder;

				/*//calculate the phone screen
				DisplayMetrics dm = new DisplayMetrics ();
				windowManager.DefaultDisplay.GetMetrics (dm);
				int width = dm.WidthPixels;
				int height = dm.HeightPixels;
				int dens = (int)dm.DensityDpi;
				double wi = (double)width / (double)dens;
				double hi = (double)height / (double)dens;
				double x = Math.Pow (wi,2);
				double y = Math.Pow (hi,2);
				double screenInches = Math.Sqrt (x + y);*/
			//vh.tvTitle.Text = mData[position].title;
			//vh.tvContent.Text = mData[position].content;


			//vh.IVLike.SetImageResource (mData[position].like);
			if (holder.GetType () == typeof(MyKomuniti_ViewHolder)) {
				MyKomuniti_ViewHolder vh = holder as MyKomuniti_ViewHolder;
				vh.tvTitle.Text = mData[position].title;
				//vh.tvContent.Text = mData[position].content;
				vh.tvDescription.Text = Html.FromHtml(mData[position].content).ToString();
				//vh.tvDescription.Text = mData[position].content.Replace("s/<(.*?)>//g","");
				vh.tvMKVLIDate.Text = mData [position].date;
				vh.tvMKVLISender.Text = mData [position].sender;
			}
		}
开发者ID:kktanpiya,项目名称:pyongPyaa048,代码行数:32,代码来源:RecyclerViewAdapter.cs


示例12: OnQueryTextChange

 /// <summary>
 /// Raises the query text change event.
 /// Filters the user list in the UsersViewModel by wether the entered string is contained in the users first/last name 
 /// </summary>
 /// <param name="newText">Text entered in the SearchView by the user</param>
 public bool OnQueryTextChange(string newText)
 {
     _recyclerView = FindViewById<RecyclerView> (Resource.Id.user_list);
     _filteredUsers = _usersViewModel.Users.ToList ().FindAll (e => (e.FirstName.ToLower() + " " + e.LastName.ToLower()).Contains (newText.ToLower()));
     SetupRecyclerView (_recyclerView);
     return true;
 }
开发者ID:GrillPhil,项目名称:EnterpriseApps,代码行数:12,代码来源:UserListActivity.cs


示例13: OnCreate

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

			// Set our view from the "main" layout resource
			this.SetContentView (Resource.Layout.movie_detail);

			// Create your application here
			var strConfig = this.Intent.Extras.GetString ("Configuration");
			var strSelectedMovie = this.Intent.Extras.GetString ("SelectedMovie");
			this.configuration = JsonConvert.DeserializeObject<ConfigurationResponse> (strConfig);
			this.movieDetail = JsonConvert.DeserializeObject<Movie> (strSelectedMovie);

			this.btnPlay = this.FindViewById<Button> (Resource.Id.movie_detail_btnPlay);
			this.btnPlay.Click += this.btnPlay_Click;
			this.btnFavorite = this.FindViewById<Button> (Resource.Id.movie_detail_btnFavorite);
			this.btnFavorite.Click += this.btnFavorite_Click;
			this.btnClose = this.FindViewById<ImageButton> (Resource.Id.movie_detail_close);
			this.btnClose.Click += this.btnClose_Click;
			this.txtTitle = this.FindViewById<TextView> (Resource.Id.movie_detail_txtTitle);
			this.txtReleaseDate = this.FindViewById<TextView> (Resource.Id.movie_detail_txtReleaseDate);
			this.ratingBar = this.FindViewById<RatingBar> (Resource.Id.movie_detail_ratingBar);
			this.txtVoteCount = this.FindViewById<TextView> (Resource.Id.movie_detail_txtVoteCount);
			this.txtOverview = this.FindViewById<TextView> (Resource.Id.movie_detail_txtOverview);
			this.imgPoster = this.FindViewById<ImageView> (Resource.Id.movie_detail_imgPoster);
			this.vwSimilarMovies = this.FindViewById<RelativeLayout> (Resource.Id.movie_detail_vwSimilarMovies);
			this.movieList = this.FindViewById<RecyclerView>(Resource.Id.movie_detail_lstSimilarMovies);
			this.movieLayoutManager = new LinearLayoutManager (this, LinearLayoutManager.Horizontal, false);
			this.movieList.SetLayoutManager (this.movieLayoutManager);

			this.updateLayout ();
		}
开发者ID:Robert-Altland,项目名称:MovieExplorer,代码行数:31,代码来源:MovieDetailActivity.cs


示例14: OnInterceptTouchEvent

 public bool OnInterceptTouchEvent (RecyclerView rv, MotionEvent e)
 {
     if (IsEnabled) {
         gestureDetector.OnTouchEvent (e);
     }
     return false;
 }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:7,代码来源:ItemTouchListener.cs


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


示例16: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.PhotoLayout1);
            _RecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView);

            var getRequest = new GetRequest ();
            var getResponse = new GetResponse ();
            getRequest.apiKey = "7gXV0uUd54z3ksYKMAG4co595dDPMaTB";
            getRequest.accessToken = "W88EaRR8PiKZXzoDe16eqlnt96CRSj0WFeEfy9ie9N565frGPqM4OVMKVOEdo9qGrYuT4ifeS2eNqrx3P6cBG6hTB3uTFfZawyOh";
            getRequest.langCode = "en-GB";
            String url = String.Format ("http://api.powhealth.com/LabTestService.svc/api/labtests/byuser/list/{0}/{1}/{2}", getRequest.apiKey, getRequest.accessToken, getRequest.langCode);

            WebRequest request = WebRequest.Create (url);
            WebResponse response = request.GetResponse ();

            var dataStream = response.GetResponseStream ();
            StreamReader reader = new StreamReader (dataStream);
            string responseFromServer = reader.ReadToEnd ();
            reader.Close ();
            response.Close ();
            var jsonObject = JsonConvert.DeserializeObject <GetResponse> (responseFromServer);

            //_LayoutManager = new LinearLayoutManager (this);
            _LayoutManager = new GridLayoutManager (this, 2, GridLayoutManager.Vertical, false);
            _RecyclerView.SetLayoutManager (_LayoutManager);
            _Adapter = new RecyclerAdapter (jsonObject.LabTestsUserOnlyResult, _RecyclerView);
            _RecyclerView.SetAdapter (_Adapter);
        }
开发者ID:RasaCosmin,项目名称:DropboxApp,代码行数:29,代码来源:PhotoActivity.cs


示例17: RecyclerViewMaterialAdapter

		/**
		 * Construct the RecyclerViewMaterialAdapter, which inject a header into an actual RecyclerView.Adapter
		 *
		 * @param adapter         The real RecyclerView.Adapter which displays content
		 * @param placeholderSize The number of placeholder items before real items, default is 1
		 */
		public RecyclerViewMaterialAdapter(RecyclerView.Adapter adapter, int placeholderSize)
		{
			_mAdapter = adapter;
			_mPlaceholderSize = placeholderSize;

			RegisterAdapterObserver();
		}
开发者ID:Julien-Mialon,项目名称:MaterialViewPager.Xamarin,代码行数:13,代码来源:RecyclerViewMaterialAdapter.cs


示例18: GetItemOffsets

 public override void GetItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
 {
     if (parent.GetChildLayoutPosition(view) != 0)
     {
         outRect.Top = space;
     }
 }
开发者ID:nepula-h-okuyama,项目名称:DroidKaigi2016Xamarin,代码行数:7,代码来源:SpaceItemDecoration.cs


示例19: OnBindViewHolder

 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     var viewHolder = holder as PhotoViewHolder;
     if (viewHolder == null) return;
     viewHolder.Image.SetImageResource(_photoAlbum[position].Id);
     viewHolder.Caption.Text = _photoAlbum[position].Caption;
 }
开发者ID:RealAikido,项目名称:MobileSamples,代码行数:7,代码来源:PhotoAlbumAdapter.cs


示例20: OnBindViewHolder

 /// <summary>
 /// Replaces the content of the view. Invoked by the layout manager
 /// </summary>
 /// <param name="holder">Holder.</param>
 /// <param name="position">Position.</param>
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     var holder2 = holder as ViewHolder;
     holder2.Text.Text = Items [position].Title;
     holder2.Image.SetImageResource (Items [position].Image);
     holder2.ItemView.Tag = Items [position];
 }
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:12,代码来源:RecyclerViewActivity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RedBlackTree类代码示例发布时间:2022-05-24
下一篇:
C# RecurrencePattern类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap