コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            SetContentView(Resource.Layout.ItemCategory);


            ItemRecyclerAdapter adapter  = new ItemRecyclerAdapter(Myitems);
            RecyclerView        recycler = FindViewById <RecyclerView>(Resource.Id.RecyclerView1);

            recycler.SetLayoutManager(new LinearLayoutManager(this)
            {
                Orientation = LinearLayoutManager.Horizontal
            });
            recycler.SetAdapter(adapter);


            text = FindViewById <TextView>(Resource.Id.TestStart2TXT);

            text.Click += (s, e) =>
            {
                text.TransitionName = "imageview1";
                Intent intent = new Intent(this, typeof(Activities.Tests_Activity));
                intent.PutExtra("ImageId", Resource.Drawable.BlurWay5.ToString());
                ActivityOptions options = ActivityOptions.MakeSceneTransitionAnimation(this, text, text.TransitionName);
                StartActivity(intent, options.ToBundle());
            };
        }
コード例 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.fragment1, null);

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

            // Create your fragment here
            List <DocumentItem> documentItems = new List <DocumentItem>();

            var uriList = Arguments.GetStringArray("UriList");

            foreach (var item in uriList)
            {
                documentItems.Add(new DocumentItem
                {
                    CreatedDate      = DateTime.Now,
                    documentImageUrl = item,
                    Tags             = new List <string> {
                        "Document", "test"
                    }
                });
            }

            //Setup RecyclerView
            adapter = new ItemRecyclerAdapter(Activity, documentItems);

            recyclerView.SetAdapter(adapter);

            layoutManager = new GridLayoutManager(Context, 2);
            recyclerView.SetLayoutManager(layoutManager);

            return(view);
        }