New UI-带阴影的TextView

New UI-带阴影的TextView

 ——转载请注明出处:coder-pig,欢迎转载,请勿用于商业用途!


小猪Android开发交流群已建立,欢迎大家加入,无论是新手,菜鸟,大神都可以,小猪一个人的

力量毕竟是有限的,写出来的东西肯定会有很多纰漏不足,欢迎大家指出,集思广益,让小猪的博文

更加的详尽,帮到更多的人,O(∩_∩)O谢谢!

小猪Android开发交流群:小猪Android开发交流群群号:421858269

新Android UI实例大全目录:http://blog.csdn.net/coder_pig/article/details/42145907



本节引言:

本节我们来学习如果为TextView的文字设置一个阴影效果~

另外,阴影效果在ADT上是不显示的,需要跑起来才能看到!



本节正文:

核心就是下面的几个属性:

android:textColor:设置文本颜色

android:shadowColor:设置阴影颜色,需要与shadowRadius一起使用哦!

android:shadowRadius:设置阴影的模糊程度,设为0.1就变成字体颜色了,建议使用3.0

android:shadowDx:设置阴影在水平方向的偏移,就是水平方向阴影开始的横坐标位置

android:shadowDy:设置阴影在竖直方向的偏移,就是竖直方向阴影开始的纵坐标位置



代码演示:

[html]   view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     xmlns:tools="http://schemas.android.com/tools"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="match_parent"  
  5.     tools:context="com.jay.example.test.MainActivity" >  
  6.   
  7.     <TextView  
  8.         android:layout_width="wrap_content"  
  9.         android:layout_height="wrap_content"  
  10.         android:layout_centerInParent="true"  
  11.         android:shadowColor="#F9F900"  
  12.         android:shadowDx="10.0"  
  13.         android:shadowDy="10.0"  
  14.         android:shadowRadius="3.0"  
  15.         android:text="带阴影的TextView"  
  16.         android:textColor="#4A4AFF"  
  17.         android:textSize="30sp" />  
  18.   
  19. </RelativeLayout>  


运行截图:




好了,关于为TextView设置阴影效果就到这里~大笑

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值