Thursday 7 June 2012

TextView in android

TextView in android.

 

  • TextView in android are works as label. 
  • It enables user to display text on the screen.
  • Generally text display in textview are static but user can set text dynamically.
  • Two ways to create text view in android
    • Using xml file in layout

               <TextView
              android:id="@+id/hello"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/hello" />
       
    • Using java code in activity class
             
               TextView tvDynamic = new TextView(this);
              tvDynamic.setText("---> Dynamically created TextView");
       
  • Types of TextView in android
    • Large TextView
      • android:textAppearance="?android:attr/textAppearanceLarge"
         
    • Medium TextView
      • android:textAppearance="?android:attr/textAppearanceMedium"
         
    • Small TextView
      • android:textAppearance="?android:attr/textAppearanceSmall"
         
    • Checked TextView
             
            <CheckedTextView

            android:id="@+id/checkedTextView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="CheckedTextView"/>
           

0 comments:

Post a Comment

Fill free to post your Queries and Suggesion...!

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Review