前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安卓开发_时间、日期选择器的简单使用

安卓开发_时间、日期选择器的简单使用

作者头像
听着music睡
发布2018-05-18 12:24:14
1.6K0
发布2018-05-18 12:24:14
举报
文章被收录于专栏:Android干货Android干货

这里介绍两个控件来简单实现日期,时间的功能

两个控件都只要在xml文件中添加一下即可

一、AnalogClock控件

代码语言:javascript
复制
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6 
 7     <TextView 
 8         android:layout_width="wrap_content"
 9         android:layout_height="wrap_content"
10         android:text="AnalogClock组件"
11         android:textSize="18dp"
12         android:paddingTop="10dp"
13         android:layout_gravity="center"
14         />
15     <AnalogClock
16         android:id="@+id/analogClock1"
17         android:layout_width="wrap_content"
18         android:layout_gravity="center"
19         android:layout_height="wrap_content" />
20 
21 </LinearLayout>

二、DialogClock控件

代码语言:javascript
复制
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6     
 7     <DigitalClock 
 8         android:layout_width="wrap_content"
 9         android:layout_height="wrap_content"
10         android:text="DiaitalClock"
11         android:id="@+id/id_clock_digitalclock"
12         android:textSize="30dp"
13         android:gravity="center"
14         android:textColor="#ff0000"
15         />
16 
17 </RelativeLayout>

效果图:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-08-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档