今天刚刚好做了个字体阴影的效果,感觉加上了阴影的效果立体感十足啊!写了个简单的demo与大家分享下!
主要是以下四个属性

android:shadowColor  阴影的颜色
  android:shadowDx       横向阴影,其值负数是往左,正数是往右
  android:shadowDy       竖直方向,其值负数是往左,正数是往右
  android:shadowRadius   阴影的半径

代码如下:

复制内容到剪贴板

代码:

<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">

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:shadowColor="#40000000"
        android:shadowDx="0"
        android:shadowDy="8"
        android:shadowRadius="1"
        android:layout_margin="20dip"
        android:text="底部阴影效果" 
        android:textSize="20sp"/>
    
     <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:shadowColor="#40000000"
        android:shadowDx="0"
        android:shadowDy="-5"        
        android:shadowRadius="1"
        android:layout_margin="20dip"
        android:text="顶部阴影" 
        android:textSize="20sp"/>
     
     
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:shadowColor="#40000000"
        android:shadowDx="-5"
        android:shadowDy="0"
        android:shadowRadius="1"
        android:layout_margin="20dip"
        android:text="左侧阴影" 
        android:textSize="20sp"/>
      
      
       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:shadowColor="#40000000"
        android:shadowDx="5"
        android:shadowDy="0"
        android:shadowRadius="1"
       android:layout_margin="20dip"
        android:text="右侧阴影" 
        android:textSize="20sp"/>

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:shadowColor="#40000000"
        android:shadowDx="5"
        android:shadowDy="5"
        android:shadowRadius="1"
       android:layout_margin="20dip"
        android:text="右下侧阴影" 
        android:textSize="20sp"/>
</LinearLayout>

效果图如下:

android之字体阴影效果的更多相关文章

  1. Android 修改字体,跳不过的 Typeface

    序 在 Android 下使用自定义字体已经是一个比较常见的需求了,最近也做了个比较深入的研究. 那么按照惯例我又要出个一篇有关 Android 修改字体相关的文章,但是写下来发现内容还挺多的,所以我 ...

  2. 通过使用CSS字体阴影效果解决hover图片时显示文字看不清的问题

    1.前言 最近需要加入一个小功能,在鼠标越过图片时,提示其大小和分辨率,而不想用增加属性title来提醒,不够好看.然而发现如果文字是一种颜色,然后总有概率碰到那张图上浮一层的文字会看不到,所以加入文 ...

  3. android textview字体加粗 Android studio最新水平居中和垂直居中

    android textview字体加粗 Android studio最新水平居中和垂直居中 Android中字体加粗在xml文件中使用android:textStyle=”bold”但是不能将中文设 ...

  4. Android系统字体规范

    我们在做Android移动APP设计的时候,字号的选择也是很让人头疼,转载一份有关Android系统字体规范,如果在做Android项目的用户应该看看,如果有任何建议欢迎在留言处与我们交流探讨. 主要 ...

  5. Android 中文字体的设置方法和使用技巧

    Android TextView字体颜色等样式具体解释连接:http://blog.csdn.net/pcaxb/article/details/47341249 1.使用字体库(自己定义字体的使用) ...

  6. Android TextView加上阴影效果

    <TextView android:id="@+id/test_shadow" android:layout_width="wrap_content" a ...

  7. Android 旋转字体 实现(应用角标,如:新,火等关键字)

    在安卓应用中常见应用图标,或者gridview ,listview每个条目上有新,火,等45度旋转的字体,然后一个红色背景,引起用户关注,来一下实现方式: 自定义一个textview,绘制字体的时候, ...

  8. 【转载】深度解析Android中字体设置

    原文:http://mobile.51cto.com/android-265238.htm 1.在Android XML文件中设置字体 可以采用Android:typeface,例如android:t ...

  9. 怎样改动android系统字体大小

    改动字体大小的方法是运用到一个ActivityManagerNative类 首先先在代码宣告 private Configuration mconfig = new Configuration(); ...

随机推荐

  1. 小学生之浅谈Struts2与struts1的运行机制

    Struts1工作原理图: 1.初始化:struts框架的总控制器ActionServlet是一个Servlet,它在web.xml中配置成自动启动的Servlet,在启动时总控制器会读取配置文件(s ...

  2. php进程继续执行

    虽然浏览器提示localhost 的服务器响应时间过长.但是进程在后台继续执行,数据库的条数在增加.

  3. tomcat startup.sh提示java.lang.OutOfMemoryError: PermGen space

    JAVA_OPTS="-server -XX:PermSize=512M -XX:MaxPermSize=1024m"if [ -z "$LOGGING_MANAGER& ...

  4. 移植openssh到nuc951 evb板

    移植openssh到nuc951 evb板 一 应用环境: 硬件:nuc951evb 软件:linux2.6.35 bsp 二 交叉编译openssl openssh 1.下载 openssl-1.0 ...

  5. php加密解密实用类

    一个加解密类.如果你想在用户忘记密码时为他或她找回原来的密码,那么这个类是个好用的工具 用户注册的密码一般不会明文保存,总得加个密先.最简单的当然是在数据库sql语句中调用md5函数加密用户密码.这里 ...

  6. 信息安全实验一:buffer-overflow

    title: buffer-overflow date: 2016-01-10 14:17:17 categories: information-security tags: buffer-overf ...

  7. d3可视化实战04:事件绑定机制

    首先说明,d3支持所有的JS事件——甚至其他代码的自定义事件.这里有一个列表,The MDN Event Reference, 包含了几乎所有浏览器创建的事件类型.大家有需要可以去查看. D3的事件绑 ...

  8. MemCache内存缓存系统

    memcached是一种缓存技术, 他可以把你的数据放入内存,从而通过内存访问提速,因为内存最快的, memcached技术的主要目的提速, 默认情况下占用的端口号为:11211. 在memachec ...

  9. HttpCookie

    参考 : http://www.cnblogs.com/fish-li/archive/2011/07/03/2096903.html 上文结尾有提到一个说法 4. HttpRequest.Cooki ...

  10. jboss部署应用

    简单的部署应用. 第一种方法是直接写JSP代码,然后放到指定的WAR文件夹中. 第二种,是同时META-INF下的application.xml文件,然后用JAR -CF编成WAR,再集合JSP形成E ...