今天刚刚好做了个字体阴影的效果,感觉加上了阴影的效果立体感十足啊!写了个简单的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. JY01-KX-01

    复习: 1.a标签跳转 <p id="地址"></p> <a href="#地址"></a> 预习: 1.out ...

  2. EF中使用Contains方法

    第一种情况 var db=new ECEntities(); var list=new []{"8","9"}; var result=from a in db ...

  3. CodeSMART for VS.NET插件工具

    今天无聊,想起以前看过的微软的Visual Studio的插件,所以就找了找. 微软的Visual Studio本身就非常强大了,但是仍然有不足的地方,比如下面要介绍的我喜欢的代码格式化功能的这个插件 ...

  4. redis例子

    http://www.cnblogs.com/edisonfeng/p/3571870.html

  5. java 对list中对象按属性排序

    实体对象类 --略 排序类----实现Comparator接口,重写compare方法 package com.tang.list; import java.util.Comparator; publ ...

  6. QT5-控件-QTimeEdit和QTime

    #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QTimeEdit> #i ...

  7. M_LROOT,LD_LIBRARY_PATH, “Not all extension Dlls were loaded”问题原因及解决方法(持续更新)

    最近在需要在云主机上进行压力测试,所以需要Linux的Agent. 一.安装:教程可以百度,大概步骤如下: 1.Upload Linux.zip to 指定的机器 2.解压,chmod 777 $Li ...

  8. apache 2.4.9 配置其他客户端访问 required all granted

    <Directory /> AllowOverride all #修改地方 Require all granted </Directory> # # Note that fro ...

  9. day03

    1.set集合--无序的,不重复的序列,类似dict,但是只有key,没有value 创建一个集合: s1 = {11,22,33} s2 = set((22,33,44))必须传入一个可迭代对象(t ...

  10. webuploader文件上传问题总结

    webuploader百度的一个很好的上传文件插件: 选择它的原因: 1.浏览器兼容性好,支持IE8,这是我最主要的,好多上传插件都不支持: 2.跨域访问,因为我的上传需要到图片服务器上,这就需要跨域 ...