0
点赞
收藏
分享

微信扫一扫

Android时钟控件

小布_cvg 2022-11-22 阅读 127


今天来介绍几个Android的时钟控件,DigitalClock,AnalogClock,TextClock,这三个控件很简单,只需要在布局文件中声明就可以了,其中TextClock在API17以后用来代替DigitalClock,我们先看看布局文件:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<DigitalClock
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<AnalogClock
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextClock
android:id="@+id/textclock"
android:format12Hour="yyyy-MM-dd hh:mm"
android:timeZone="GMT+08:00"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

然后看效果图

Android时钟控件_控件


举报

相关推荐

0 条评论