Back to project page DecorateCalendarView.
The source code is released under:
Apache License
If you think the Android project DecorateCalendarView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.zaim.decoratecalendarview.sample; /*w w w . j a v a 2s. com*/ import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.widget.Toast; import net.zaim.decoratecalendarview.DecorateCalendarView; import java.text.SimpleDateFormat; import java.util.Date; public class MainActivity extends ActionBarActivity implements DecorateCalendarView.OnDecorateCalendarListener { private DecorateCalendarView mCalendarView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mCalendarView = (DecorateCalendarView) findViewById(R.id.my_calendar); Bundle bundle = new Bundle(); bundle.putString(DecorateCalendarView.BUNDLE_KEY_SELECTED_COLOR, String.valueOf(getResources().getColor(R.color.select_background))); mCalendarView.setOnDecorateCalendarListener(this); mCalendarView.initCalendar(getSupportFragmentManager(), bundle); } @Override public void onDayClick(Date day) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Toast.makeText(this, format.format(day), Toast.LENGTH_SHORT).show(); } @Override public void onChangeDisplayMonth(Date date) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); Toast.makeText(this, format.format(date), Toast.LENGTH_SHORT).show(); // Decorate cell of day mCalendarView.setTopTextOnDay(10, "top", Color.parseColor("#00ff00")); mCalendarView.setMiddleTextOnDay(10, "middle", Color.parseColor("#ff0000")); mCalendarView.setBottomTextOnDay(10, "bottom", Color.parseColor("#0000ff")); } }