728x90
반응형
SMALL
Material CalendarView
Material CalendarView는 Android의 CalendarView의 머티리얼 디자인 백 포트이다.
build.gradle
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
strings.xml
<resources>
<string-array name="custom_weekdays">
<item>일</item>
<item>월</item>
<item>화</item>
<item>수</item>
<item>목</item>
<item>금</item>
<item>토</item>
</string-array>
<string-array name="custom_months">
<item>1월</item>
<item>2월</item>
<item>3월</item>
<item>4월</item>
<item>5월</item>
<item>6월</item>
<item>7월</item>
<item>8월</item>
<item>9월</item>
<item>10월</item>
<item>11월</item>
<item>12월</item>
</string-array>
</resources>
xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
android:id="@+id/calendarview"
app:mcv_selectionColor="#03A9F4"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
kt
class main : AppCompatActivity() {
val binding by lazy { ActivityMainBinding.inflate(layoutInflater)}
lateinit var calendar: MaterialCalendarView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
val calendar = binding.calendarview
calendar.setTitleFormatter(
MonthArrayTitleFormatter(getResources().getTextArray(
R.array.custom_months))
);
calendar.setWeekDayFormatter(ArrayWeekDayFormatter(getResources().getTextArray(R.array.custom_weekdays)));
}
}
728x90
반응형
LIST
'App Programming > Kotlin' 카테고리의 다른 글
[Kotlin] DotSpan (Material CalendarView) (0) | 2023.01.19 |
---|---|
[Kotlin] Decorator (Material CalendarView) (0) | 2023.01.19 |
[Kotlin] timePicker (0) | 2023.01.17 |
[Kotlin] 구글 자동 로그인 (0) | 2023.01.15 |
[Kotlin] 파이어베이스 구글 로그인 (0) | 2023.01.15 |