コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            month = Calendar.Instance;

            //Static date set
            System.String   date      = "2015-07-31";
            char[]          splitchar = { '-' };
            System.String[] dateArr   = date.Split(splitchar);           // date format is yyyy-mm-dd



            //month.set(Integer.parseInt(dateArr[0]), Integer.parseInt(dateArr[1]), Integer.parseInt(dateArr[2]));
            month.Set(Int16.Parse(dateArr[0]), Int16.Parse(dateArr[1]), Int16.Parse(dateArr[2]));

            items   = new ArrayList();
            adapter = new CalendarAdapter(this, month);

            date_date();

            GridView gridview = (GridView)FindViewById(Resource.Id.gridview);

            gridview.SetAdapter(adapter);
            gridview.ItemClick += grid_click;

            TextView title = (TextView)FindViewById(Resource.Id.title);

            title.Text = Android.Text.Format.DateFormat.Format("MMMM yyyy", month);

            TextView previous = (TextView)FindViewById(Resource.Id.previous);

            previous.Click += previous_click;

            TextView next = (TextView)FindViewById(Resource.Id.next);

            next.Click += next_click;
        }
コード例 #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Main);

			month = Calendar.Instance;

			//Static date set
			System.String date = "2015-07-31";
			char[] splitchar = { '-' };
			System.String[] dateArr = date.Split(splitchar); // date format is yyyy-mm-dd



			//month.set(Integer.parseInt(dateArr[0]), Integer.parseInt(dateArr[1]), Integer.parseInt(dateArr[2]));
			month.Set(Int16.Parse(dateArr[0]), Int16.Parse(dateArr[1]),Int16.Parse(dateArr[2]));

			items = new ArrayList();
			adapter = new CalendarAdapter(this, month);

			date_date ();

			GridView gridview = (GridView)FindViewById (Resource.Id.gridview);
			gridview.SetAdapter(adapter);
			gridview.ItemClick += grid_click;

			TextView title  = (TextView) FindViewById(Resource.Id.title);
			title.Text = Android.Text.Format.DateFormat.Format("MMMM yyyy",month);

			TextView previous = (TextView) FindViewById (Resource.Id.previous);
			previous.Click += previous_click; 

			TextView next = (TextView) FindViewById (Resource.Id.next);
			next.Click += next_click; 

		}