Sunday, 19 June 2011

Place shadow behind text using XML

We can define XML Attributes to place a shadow of the specified color behind the text.

  • android:shadowColor - Place a shadow of the specified color behind the text.
  • android:shadowDx - Horizontal offset of the shadow.
  • android:shadowDy - Vertical offset of the shadow.
  • android:shadowRadius - Radius of the shadow.


Place shadow behind text

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textSize="20dp"
android:shadowColor="#FFFFFF"
android:shadowRadius="5"
android:shadowDx="10"
android:shadowDy="10"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:shadowColor="#000000"
android:shadowRadius="5"
android:shadowDx="10"
android:shadowDy="10"
/>
</LinearLayout>



Related article:
- Set shadow of TextView in Java code, setShadowLayer()

Borneo08

About Borneo08

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

More links

Related Posts Plugin for WordPress, Blogger...