A review of CalendarView.java indicates that the highlighted row is overrided by an internal private class which consumes the touch event, so neither OnClickListener() nor OnTouchListener() will work.
The first (harder) options is to make your own copy of CalendarView.java (call it MyCustomCalendarView.java) and include it into your project. Within MyCustomCalendarView.java, add code to register an OnTouchListener like so:
private View.OnTouchListener touchListener;
@Override
public void setOnTouchListener( View.OnTouchListener otl) {
touchListener = otl;
}
Then in the private class WeeksAdapter's OnTouch() method, add this line:
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mListView.isEnabled() && mGestureDetector.onTouchEvent(event)) {
touchListener.onTouch(v, event);
...
Then MyCustomCalendarView could be used as follows:
MyCustomCalendarView thisCalendar = (MyCustomCalendarView) rootView.findViewById(R.id.mycustom_calendar_view_layout_id);
thisCalendar.setOnTouchListener(myCustomListener);
Another (easier) alternative is to add a button to the calendarView layout, and use the button's onClickListener (plus maybe a flag variable) to detect whether any date has been selected. In this case, selecting the current date will be the same as "no date selected" from the device's point of view, so you can use that fact to write in today's date, or other custom actions.
You can use datetimepicker-library's date picker layout to help you get started:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:background="@color/date_picker_view_animator"
android:layout_width="@dimen/date_picker_component_width"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="@dimen/selected_calendar_layout_height">
<include layout="@layout/date_picker_selected_date" />
</LinearLayout>
<!-- this is the calendarView, add your own version here as you see fit -->
<include layout="@layout/date_picker_view_animator" />
<!-- this is the button to be added to this layout -->
<View
android:background="@color/line_background"
android:layout_width="@dimen/date_picker_component_width"
android:layout_height="1.0dip" />
<include layout="@layout/date_picker_done_button" />
</LinearLayout>