安卓时间显示TextClock显示日期时间,24小时制和12小时制(自定义

安卓时间显示TextClock显示日期时间,24小时制和12小时制(自定义时间)

这个地方的是按24小时制还是12小时制 是由手机系统设置决定的,星期日如果显示为英文也是系统语言设置决定的

android:layout_width="wrap_content"

android:layout_marginRight="10dp"

android:format12Hour="yyyy-MM-dd hh:mm:ss, EEEE a"

android:format24Hour ="yyyy-MM-dd\nHH:mm:ss EEEE"

android:layout_height="wrap_content">

"MM/dd/yy h:mmaa" -> "03/07/70 6:23am"

"MMM dd, yyyy h:mmaa" -> "Apr 5, 2020 7:21am"

"MMMM dd, yyyy h:mmaa" -> "April 6, 2020 7:21am"

"E, MMMM dd, yyyy h:mmaa" -> "Mon, April 7, 2020 7:21am&

"EEEE, MMMM dd, yyyy h:mmaa" -> "Monday, April 6, 2020 6:23am"

android:layout_width="wrap_content"

android:layout_height="wrap_content">

16b162f90b427df98b461be01e95c4a4.png

时间选择控件

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:timePickerMode="spinner"

android:layout_gravity="center"

>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:timePickerMode="clock"

>

2504ec636ae2694094a27983a5c02471.png

安卓时间显示TextClock显示日期时间,24小时制和12小时制(自定义相关教程

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐