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

    bc上的题目,很水,有很多方法做吧,题意大概就是给定你票数,然后让你求出票数最多的那个下标...... 之前我用两个for循环分开写,一个是读入,然后是判断,提交就wa,后来网上看了别人的,就是不能分 ...

  2. Calling a C++ dll with unsigned char* parameters

    unsigned char*  等价 BYTE* 例1: C++: int __stdcall LIVESCAN_GetFPRawData(int nChannel, unsigned char *p ...

  3. js获取当前事件键盘按钮

    用户名:<input type="text" name="username" id="username"><br /> ...

  4. Jsp通过JDBC连接到SQL Server2008数据库遇到的几个问题

    今天刚刚学jdbc ,之前通过main连到过Sql server 2008现在通过jsp连接sql server 2008,遇到了一些问题,跟大家分享一下,避免少走弯路 一.ClassNotFound ...

  5. 武汉科技大学ACM:1005: Soapbear and Honey

    Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey ve ...

  6. linux入门。删除不用到内核,为boot分区释放空间

    在终端中输入如下命令: dpkg --get-selections|grep linux-image 这时会列出系统中所有到内核. 你可以使用 uname -a 查看你当前使用到内核. 然后用 sud ...

  7. ext中处理Combobox组件点击触发后台事件的问题

    ext的Combobox组件在绑定数据的时候需要一个Store来绑定数据,在store里面我们可以设置autoLoad属性,这个属性表示Store可以自动的到后台获取数据,ext实质上就是封装好的ja ...

  8. java8+spring+angularjs 项目应用

    最近有写一个电子订单商务网站,使用JAVA8,SPRING,ANGULARJS对项目使用的技术和大家分享. 第一次写博客,哪有不对需要改正的请联系改正. 因为是项目是我给别人做的无法提供源码见谅,我尽 ...

  9. JQuery里属性赋值,取值prop()和attr()方法?

    1.赋值的时候 如果是<input type="checkbox" checked>这样的只有属性名就能生效的属性 推荐prop,即:$('input').prop(' ...

  10. 转 jQuery(图片、相册)插件代码实例

    jQuery想必大部分前端er都知道甚至很熟悉了,网上有数以万计的优秀的jQuery插件以及教程,今天收集了一些关于图片.相册的jQuery插件代码,希望会对你有所帮助. 1. 3D Gallery ...