Android实战简易教程-第六十五枪(自定义控件实现数字液晶时钟Demo)

本文档介绍如何在Android中创建一个自定义控件,实现液晶数字时钟的效果。开发者通过新建Activity并调用该控件,展示了液晶时钟的实现过程。虽然在录制过程中遇到了显示问题,但鼓励读者亲自运行代码以体验完整效果。提供源码下载,欢迎关注。
摘要由CSDN通过智能技术生成
下面我们研究一下如何实现一个数字液晶时钟,本质属于特效一种哈。
首先创建一个布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
      <TextView  
        android:id ="@+id/ledview_clock_time"  
        android:layout_width ="wrap_content"  
        android:layout_height ="wrap_content"  
        android:layout_centerInParent="true"
        android:shadowColor ="#00ff00"  
        android:shadowDx ="0"  
        android:shadowDy ="0"  
        android:shadowRadius ="10"  
        android:textColor ="#00ff00"  
        android:textSize ="80sp" />  
        
    <TextView
        android:id ="@+id/ledview_clock_bg"   
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"  
        android:layout_centerInParent="true"
        android:layout_gravity="center"  
        android:text="@string/default_time"  
        android:textColor="#3300ff00"  
        android:textSize="80sp" />  
  

</RelativeLayout>


对于阴影的几个属性我们引用一下别人博客里的内容:(http://blog.csdn.net/whoispo/article/details/8061907)
Android的TextView的XML属性中有关于阴影的几条属性
shadowDX、shadowDy、shadowRadius,说明分别是阴影的横、纵坐标偏移
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值