如何在按钮上打开日历单击并获取可点击日期。
答案 0 :(得分:3)
检查一下:http://www.developer.com/ws/article.php/3850276/Working-with-the-Android-Calendar.htm
编辑:
要从按钮点击事件打开日历,请将此代码添加到onClick方法:
Intent i = new Intent();
//Froyo or greater (mind you I just tested this on CM7 and the less than froyo one worked so it depends on the phone...)
cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity");
//less than Froyo
cn = new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity");
i.setComponent(cn);
startActivity(i);
答案 1 :(得分:0)
尝试使用CalendarView小部件,请参阅文档here
这不是一个对话框,所以你必须创建一个对话框,将它包装在CalendarView中并自己启动它。