Android TextView

Android TextView

In this Android Tutorial for beginners we are going to see about android basic widgets. We have already seen about how to display words using TextView, and also have seen some more TextView properties. In this post we are going to see about android TextView advanced properties.

Android TextView – Properties

  • Lets see the basic properties of the Android TextView
android:textStyle="bold"
android:textSize="18pt"
android:typeface="sans"
android:textColor="#36ff00"

Android TextView – Description of each Properties

Below you can find the description of each Android TextView properties.
  • android:textStyle — Style (bold, italic, bolditalic) of the text field. [flag]
  • android:textSize — Size of the text field. [dimension]
  • android:typeface — Typeface (normal, sans, serif, monospace) of the text field. [enum]
  • android:textColor — Color of the Text. [reference, color]
For this you need to create one TextView and follow the steps in the below image, and play with the values till you get your desire result.

android textview

  • The following code is used to give the shadow effects in the Android TextView.
 android:shadowColor="#1868b2"
 android:shadowRadius="2.0"
 android:shadowDy="5.0"
 android:shadowDx="5.0"
  • Insert this following code in your Android TextView makes the text to Capitalized.
android:textAllCaps="true"

android:textAllCaps — Present the text in ALL CAPS. [boolean]
Complete Source Code
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center" >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/vimal"
        android:textStyle="bold"
        android:textSize="18pt"
        android:typeface="sans"
        android:textColor="#36ff00"
        android:shadowColor="#1868b2"
        android:shadowRadius="2.0"
        android:shadowDy="5.0"
        android:shadowDx="5.0"
         />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/vimal"
        android:textStyle="bold"
        android:textSize="18pt"
        android:typeface="sans"
        android:textColor="#36ff00"
        android:textAllCaps="true"
        android:shadowColor="#ffd803"
        android:shadowRadius="15.0"
         />
</LinearLayout>
In this Android TextView tutorial, we have seen about the android textview properties and its usage.

2 comments

  1. Your Text view example is awesome. But i am not able to do with the linear layout shadow effect. Can you post another example of linearlayout shadow effect.

Leave a Reply

Scroll To Top

Foolow Me on Google Plus

VimalTuts on Twitter
62 people follow VimalTuts
MageshKeiambgvLukus_Q7ravon30silly_piubemafoovedpawarmohammed