对于Android 初学者来说我推荐 :TimePickerView 好用 代码简洁更容易看懂
优点:
1 , 年月日可自行修改
2 ,字体颜色 展示都可修改。直接上代码
示例如下:
步骤
1.添加Jcenter仓库 Gradle依赖:
implementation 'com.contrarywind:Android-PickerView:3.2.4'
2 ,
public static void showDatePickerStart(Activity activity, TextView textView) {
Calendar startDate = Calendar.getInstance();
startDate.set(2020, 00, 01);
Calendar endDate = Calendar.getInstance();
showDatePicker(activity, startDate, endDate, calendar -> textView.setText(calendar.get(Calendar.YEAR) + "年"
+ (String.format("%02d", calendar.get(Calendar.MONTH) + 1)) + "月" +
(String.format("%02d",