mCalendarView.setOnDayClickListener(new OnDayClickListener() {
@Override
public void onDayClick(EventDay eventDay) {
// Log.e("Event",((MyEventDay) eventDay).getNote()+" <--");
}
});
出现错误:
Cannot resolved method 'setOnDayClickListener(anonymous com.applandeo.materialcalendarview.listeners.OnDayClickListener)'
还有其他方法可以实现
onDayClick()
方法吗? 最佳答案
实施错误的类可能是您的问题
在您的布局xml
<com.applandeo.materialcalendarview.CalendarView
android:id="@+id/mCalendarView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
在您的
Activity
com.applandeo.materialcalendarview.CalendarView mCalendarView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
calendarView = (com.applandeo.materialcalendarview.CalendarView) findViewById(R.id.mCalendarView);
...
设置
setOnDayClickListener
方法mCalendarView.setOnDayClickListener(new OnDayClickListener() {
@Override
public void onDayClick(EventDay eventDay) {
// Log.e("Event",((MyEventDay) eventDay).getNote()+" <--");
}
});