New UI-帶陰影的TextView,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:設定陰影在豎直方向的位移,就是豎直方向陰影開始的縱座標位置
代碼示範:
<RelativeLayout 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" tools:context="com.jay.example.test.MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:shadowColor="#F9F900" android:shadowDx="10.0" android:shadowDy="10.0" android:shadowRadius="3.0" android:text="帶陰影的TextView" android:textColor="#4A4AFF" android:textSize="30sp" /></RelativeLayout>
運行:
好了,關於為TextView設定陰影製作效果就到這裡~