Android 是否将自定义事件添加到caldroid?
我一直在搜索一个日历视图,它允许我添加自定义事件并对其进行自定义。目前,我的应用程序面向所有使用android姜饼及以上版本的android用户,caldroid似乎是最佳选择。 我无法使用ExtendedCalendarView,因为它所需的最小API为14 然而,我还不能将自定义事件添加到caldroid片段中,文档似乎也帮不了什么忙。Android 是否将自定义事件添加到caldroid?,android,events,calendar,android-custom-view,Android,Events,Calendar,Android Custom View,我一直在搜索一个日历视图,它允许我添加自定义事件并对其进行自定义。目前,我的应用程序面向所有使用android姜饼及以上版本的android用户,caldroid似乎是最佳选择。 我无法使用ExtendedCalendarView,因为它所需的最小API为14 然而,我还不能将自定义事件添加到caldroid片段中,文档似乎也帮不了什么忙。 有人能帮我解决这个问题吗?caldroid不支持日常活动,你应该自己动手制作 首先,制作自定义片段和自定义适配器,如下所示: 然后,添加以下代码: 创建自
有人能帮我解决这个问题吗?caldroid不支持日常活动,你应该自己动手制作 首先,制作自定义片段和自定义适配器,如下所示: 然后,添加以下代码:
class DailyEvent {
public String title;
public DateTime date;
}
protected HashMap<DateTime, DailyEvent> events = new HashMap<DateTime, DailyEvent>();
public void refreshView() {
// If month and year is not yet initialized, refreshView doesn't do
// anything
if (month == -1 || year == -1) {
return;
}
refreshMonthTitleTextView();
// Refresh the date grid views
for (CaldroidGridAdapter adapter : datePagerAdapters) {
// Reset caldroid data
adapter.setCaldroidData(getCaldroidData());
// Reset extra data
adapter.setExtraData(extraData);
// reset events
adapter.events = events
// Refresh view
adapter.notifyDataSetChanged();
}
}
caldroid不支持日常活动,您应该手动创建它 首先,制作自定义片段和自定义适配器,如下所示: 然后,添加以下代码:
class DailyEvent {
public String title;
public DateTime date;
}
protected HashMap<DateTime, DailyEvent> events = new HashMap<DateTime, DailyEvent>();
public void refreshView() {
// If month and year is not yet initialized, refreshView doesn't do
// anything
if (month == -1 || year == -1) {
return;
}
refreshMonthTitleTextView();
// Refresh the date grid views
for (CaldroidGridAdapter adapter : datePagerAdapters) {
// Reset caldroid data
adapter.setCaldroidData(getCaldroidData());
// Reset extra data
adapter.setExtraData(extraData);
// reset events
adapter.events = events
// Refresh view
adapter.notifyDataSetChanged();
}
}
caldroid不支持日常活动,您应该手动创建它 首先,制作自定义片段和自定义适配器,如下所示: 然后,添加以下代码:
class DailyEvent {
public String title;
public DateTime date;
}
protected HashMap<DateTime, DailyEvent> events = new HashMap<DateTime, DailyEvent>();
public void refreshView() {
// If month and year is not yet initialized, refreshView doesn't do
// anything
if (month == -1 || year == -1) {
return;
}
refreshMonthTitleTextView();
// Refresh the date grid views
for (CaldroidGridAdapter adapter : datePagerAdapters) {
// Reset caldroid data
adapter.setCaldroidData(getCaldroidData());
// Reset extra data
adapter.setExtraData(extraData);
// reset events
adapter.events = events
// Refresh view
adapter.notifyDataSetChanged();
}
}
caldroid不支持日常活动,您应该手动创建它 首先,制作自定义片段和自定义适配器,如下所示: 然后,添加以下代码:
class DailyEvent {
public String title;
public DateTime date;
}
protected HashMap<DateTime, DailyEvent> events = new HashMap<DateTime, DailyEvent>();
public void refreshView() {
// If month and year is not yet initialized, refreshView doesn't do
// anything
if (month == -1 || year == -1) {
return;
}
refreshMonthTitleTextView();
// Refresh the date grid views
for (CaldroidGridAdapter adapter : datePagerAdapters) {
// Reset caldroid data
adapter.setCaldroidData(getCaldroidData());
// Reset extra data
adapter.setExtraData(extraData);
// reset events
adapter.events = events
// Refresh view
adapter.notifyDataSetChanged();
}
}
首先,创建CaldroidSampleCustomAdapter和CaldroidSampleCustomFragment,如以下示例所示: 1.创建事件类:
public class Event {
public int type;
public String msg;
public Event(int type,String msg) { this.type = type; this.msg = msg; }
public String getMsg(){ return this.msg;}
}
protected HashMap < DateTime, Event > events = new HashMap< DateTime,Event >();
Event event = this.events.get(dateTime);
tv1.setText(event.getMsg());
首先,创建CaldroidSampleCustomAdapter和CaldroidSampleCustomFragment,如以下示例所示: 1.创建事件类:
public class Event {
public int type;
public String msg;
public Event(int type,String msg) { this.type = type; this.msg = msg; }
public String getMsg(){ return this.msg;}
}
protected HashMap < DateTime, Event > events = new HashMap< DateTime,Event >();
Event event = this.events.get(dateTime);
tv1.setText(event.getMsg());
首先,创建CaldroidSampleCustomAdapter和CaldroidSampleCustomFragment,如以下示例所示: 1.创建事件类:
public class Event {
public int type;
public String msg;
public Event(int type,String msg) { this.type = type; this.msg = msg; }
public String getMsg(){ return this.msg;}
}
protected HashMap < DateTime, Event > events = new HashMap< DateTime,Event >();
Event event = this.events.get(dateTime);
tv1.setText(event.getMsg());
首先,创建CaldroidSampleCustomAdapter和CaldroidSampleCustomFragment,如以下示例所示: 1.创建事件类:
public class Event {
public int type;
public String msg;
public Event(int type,String msg) { this.type = type; this.msg = msg; }
public String getMsg(){ return this.msg;}
}
protected HashMap < DateTime, Event > events = new HashMap< DateTime,Event >();
Event event = this.events.get(dateTime);
tv1.setText(event.getMsg());
您想详细说明吗?是的,请详细说明。扩展caldroid片段和侦听器后我该怎么办?对不起,您所说的“自定义事件”是指编程事件还是日间事件@AbdulrazakAlkl Day事件(请:)获取此代码的错误。受保护的事件不可访问。你能在github上发布一个示例项目吗?你想详细说明吗?是的,请详细说明。扩展caldroid片段和侦听器后我该怎么办?对不起,你所说的“自定义事件”是指编程事件还是日常事件@AbdulrazakAlkl Day事件(请:)获取此代码的错误。受保护的事件不可访问。你能在github上发布一个示例项目吗?你想详细说明吗?是的,请详细说明。扩展caldroid片段和侦听器后我该怎么办?对不起,你所说的“自定义事件”是指编程事件还是日常事件@AbdulrazakAlkl Day事件(请:)获取此代码的错误。受保护的事件不可访问。你能在github上发布一个示例项目吗?你想详细说明吗?是的,请详细说明。扩展caldroid片段和侦听器后我该怎么办?对不起,你所说的“自定义事件”是指编程事件还是日常事件@AbdulrazakAlkl Day事件(请:)获取此代码的错误。受保护的事件不可访问。你能在github上发布一个示例项目吗?你的链接已经死了:(你的链接已经死了)(你的链接已经死了):(