Android font Shadow effect

Source: Internet
Author: User

Today just good to do a font shadow effect, feeling with the effect of the shadow of the three-dimensional full ah! Wrote a simple demo to share with you!
The main is the following four properties

Android:shadowcolor the color of the shadow
ANDROID:SHADOWDX The horizontal shadow, whose value is negative to the left and positive to the right
Android:shadowdy the vertical direction, the negative value is left, positive is the right
Android:shadowradius radius of the shadow


The code is as follows:

copy content to clipboardCode:<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= "Bottom Shadow effect"
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= "Top Shadow"
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= "Left Shadow"
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= "Right Shadow"
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= "lower Right Side Shadow"
Android:textsize= "20sp"/>
</LinearLayout>

As follows:


Android font Shadow effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.