use this library
compile 'devs.mulham.horizontalcalendar:horizontalcalendar:1.1.7'
and this in xml
<devs.mulham.horizontalcalendar.HorizontalCalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FAFAFA"
app:selectedDateBackground="#00ffffff"
app:selectorColor="#c62828"
app:textColorNormal="#bababa"
app:textColorSelected="@color/blue_color"
app:textSizeDayName="20sp"
app:textSizeDayNumber="20sp" />
and here Java
private HorizontalCalendar horizontalCalendar;
Calendar endDate = Calendar.getInstance();
endDate.add(Calendar.MONTH, 1);
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.MONTH, -1);
horizontalCalendar = new HorizontalCalendar.Builder(root, R.id.calendarView)
.startDate(startDate.getTime())
.endDate(endDate.getTime())
.datesNumberOnScreen(5)
.dayNameFormat("EEE")
.dayNumberFormat("dd")
.monthFormat("MMM")
.textSize(14f, 24f, 14f)
.showDayName(true)
.showMonthName(true)
.build();
horizontalCalendar.setCalendarListener(new HorizontalCalendarListener() {
@Override
public void onDateSelected(Date date, int position) {
// Toast.makeText(getContext(), DateFormat.getDateInstance().format(date) + " is selected!", Toast.LENGTH_SHORT).show();
}
});
'기타 ETC > Android Studio' 카테고리의 다른 글
안드로이드 애드몹 리워드 광고 누르고 다음 액티비티로 넘어가기 (0) | 2020.11.25 |
---|---|
안드로이드 애드몹 보상형 광고 간단하게 만들어 보기 (0) | 2020.11.25 |
안드로이드 TTS(TextToSpeech) 음성출력 사용하기 (0) | 2020.07.22 |
Android SQLite Error: android.database.sqlite.SQLiteException: no such column: (code 1) (0) | 2020.07.15 |
COVID19 TRACKER Android source code (0) | 2020.07.14 |