New UI-帶陰影的TextView,ui-textview

來源:互聯網
上載者:User

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設定陰影製作效果就到這裡~




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.