Android日历控件

CalendarView控件需要API11及以上使用

<CalendarView
    android:id="@+id/calendar_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />


CalendarView calendarView = (CalendarView) findViewById(R.id.calendar_view);
calendarView.setOnDateChangeListener(new OnDateChangeListener() {
			
    @Override
    public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
        String date = year + "年" + month + "月" + dayOfMonth + "日";
        Toast.makeText(getApplicationContext(), date, Toast.LENGTH_LONG).show();
    }
});

你可能感兴趣的:(android,日历,CalendarView)