LightCalendarView 项目使用教程
1. 项目的目录结构及介绍
LightCalendarView 项目的目录结构如下:
LightCalendarView/
├── app/
│ ├── build.gradle
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── jp/co/recruit_mp/android/lightcalendarview/
│ │ │ │ ├── MainActivity.kt
│ │ │ │ └── ...
│ │ │ ├── res/
│ │ │ │ ├── layout/
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ └── ...
│ │ │ │ └── ...
│ │ │ └── AndroidManifest.xml
│ │ └── ...
│ └── ...
├── library/
│ ├── build.gradle
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── jp/co/recruit_mp/android/lightcalendarview/
│ │ │ │ ├── LightCalendarView.kt
│ │ │ │ └── ...
│ │ │ ├── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── ...
│ │ │ │ ├── layout/
│ │ │ │ │ └── ...
│ │ │ │ └── ...
│ │ │ └── AndroidManifest.xml
│ │ └── ...
│ └── ...
├── build.gradle
├── settings.gradle
└── ...
目录结构介绍
-
app/
:包含示例应用的代码和资源文件。build.gradle
:应用模块的构建配置文件。src/main/java/jp/co/recruit_mp/android/lightcalendarview/
:包含应用的主要代码文件,如MainActivity.kt
。src/main/res/
:包含应用的资源文件,如布局文件activity_main.xml
。src/main/AndroidManifest.xml
:应用的清单文件。
-
library/
:包含 LightCalendarView 库的代码和资源文件。build.gradle
:库模块的构建配置文件。src/main/java/jp/co/recruit_mp/android/lightcalendarview/
:包含库的主要代码文件,如LightCalendarView.kt
。src/main/res/
:包含库的资源文件,如 drawable 和 layout 文件。src/main/AndroidManifest.xml
:库的清单文件。
-
build.gradle
:项目的根构建配置文件。 -
settings.gradle
:项目的设置文件,包含模块的配置。
2. 项目的启动文件介绍
MainActivity.kt
MainActivity.kt
是示例应用的启动文件,负责初始化和显示 LightCalendarView。
package jp.co.recruit_mp.android.lightcalendarview
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
activity_main.xml
activity_main.xml
是 MainActivity
的布局文件,包含 LightCalendarView 的定义。
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<jp.co.recruit_mp.android.lightcalendarview.LightCalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</layout>
3. 项目的配置文件介绍
build.gradle (应用模块)
应用模块的 build.gradle
文件包含依赖项和其他构建配置。
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30