Wednesday, July 4, 2012

TextView in android




Program To display number, string, long number, float and double in TextView
click here






TextView , Large TextView, Medium TextView, Small TextView

package name: selva.text

project name: Textview

Android version: 1.5 (support 1.5 and above versions)


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" >
    
   
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#00FF00"
        android:text="This is TextView" />

      <View
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#FF4500"/>
    
    
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is Large Text"
        android:textColor="#FFD700"
        android:textAppearance="?android:attr/textAppearanceLarge" />
    
     <View
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#FF4500"/>

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is Medium Text"
        android:textColor="#8B0000"
        android:textAppearance="?android:attr/textAppearanceMedium" />
     <View
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#FF4500"/>

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is Small Text"
        android:textColor="#ffffff"
        android:textAppearance="?android:attr/textAppearanceSmall" />
 <View
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#FF4500"/>

</LinearLayout>



TextviewActivity
.java



public class TextviewActivity extends Activity 
{
    /** Called when the activity is first created. */
   
    @Override
    public void onCreate(Bundle savedInstanceState)
     {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
     }
}


OUTPUT:









Program To display number, string, long number, float and double in TextView
click here




No comments:

Post a Comment