Add Wheel Date - Time Picker in Android Jetpack Compose.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 |
以下内容由 AI 翻译,如有问题请 点此提交 issue 反馈
WheelPickerCompose
在Android Jetpack Compose中添加轮盘日期和时间选择器。

使用方法
| 选择器类型 | 示例用法 |
|---|---|
![]() |
WheelDateTimePicker { snappedDateTime -> ... } |
![]() |
WheelDatePicker { snappedDate -> ... } |
![]() |
WheelTimePicker { snappedTime -> ... } |
![]() |
WheelTimePicker(timeFormat = TimeFormat.AM_PM) { snappedTime -> ... } |
功能特点
以下代码示例展示了如何配置WheelDateTimePicker,定制其外观和行为:
WheelDateTimePicker(
startDateTime = LocalDateTime.of(2025, 10, 20, 5, 30),
minDateTime = LocalDateTime.now(),
maxDateTime = LocalDateTime.of(2025, 10, 20, 5, 30),
timeFormat = TimeFormat.AM_PM,
size = DpSize(200.dp, 100.dp),
rowCount = 5,
textStyle = MaterialTheme.typography.titleSmall,
textColor = Color(0xFFffc300),
selectorProperties = WheelPickerDefaults.selectorProperties(
enabled = true,
shape = RoundedCornerShape(0.dp),
color = Color(0xFFf1faee).copy(alpha = 0.2f),
border = BorderStroke(2.dp, Color(0xFFf1faee))
)
) { snappedDateTime -> /* 处理选定的时间 */ }
展示效果:

配置项目
-
打开
settings.gradle(文件内容示例如下)dependencyResolutionManagement { repositories { google() mavenCentral() // 添加JitPack仓库 maven { url 'https://jitpack.io' } ... } } -
同步项目。
-
添加依赖项到您的
build.gradle文件中。dependencies { implementation 'com.github.commandiron:WheelPickerCompose:1.1.11' } -
如果你的应用支持API级别低于26,则需进行额外配置(可选)
compileOptions { coreLibraryDesugaringEnabled true } dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6' }
项目介绍
Add Wheel Date - Time Picker in Android Jetpack Compose.
Apache-2.0 Kotlin251提交数androidandroid-libandroid-sdk-librarycompose-librarydate-pickerjetpack-composekotlinkotlin-librarylibrarypickertime-pickeruiviewwheel-pickerwheelpicker
定制我的领域

