<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >    <DigitalClock         android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textColor="#FF00FF00"        android:textSize="40sp"        />    <TextClock        android:id="@+id/my_tc"         android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textColor="#FFFF0000"        android:textSize="40sp"        />    </LinearLayout>


/* * 使用TextClock显示时间日期,布局文件textc.xml,API 4.2后使用 */public void setTextClock(){textclock=(TextClock) findViewById(R.id.my_tc);// 设置12时制显示格式textclock.setFormat12Hour("EEEE, MMMM dd, yyyy h:mmaa");         // 设置24时制显示格式textclock.setFormat24Hour("yyyy-MM-dd hh:mm, EEEE");}


更多相关文章

  1. Android官方教程翻译(3)——创建一个简单的用户界面
  2. android 判断手机号是否格式正确
  3. Andriod: 在xml布局中使用自定义属性
  4. Android(安卓)- Toolbar 神秘的左margin
  5. RecyclerView的简单使用
  6. Android中MenuInflater的使用(布局文件定义Menu菜单)
  7. Android自定义炫酷进度条(闪电能量条)
  8. Android使用setContentView实现页面的转换效果
  9. android stuidio 学习总结1

随机推荐

  1. android 对软键盘的显示和消失监听
  2. 安装android studio 不能启动
  3. android图片上传springMvc
  4. TextInputLayout,让输入框更有灵性
  5. android kill package
  6. Android 常用的SDCARD和内存操作
  7. android > SDcard读写文件
  8. Android 读取本地txt文件和写入txt文件到
  9. Android os设备谎言分辨率的解决方案
  10. Android部分字体高亮