วันเสาร์ที่ 2 มิถุนายน พ.ศ. 2555

Hello Android The First App


Hello Android The First App. 


Code for HelloAndroid.java 

























package com.example.hello;

import android.app.Activity;
import android.os.Bundle;

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

 
Code XML in 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:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#0000FF"
        android:text="Medium Text Blue Colour"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Large Text Red Colour"
        android:textColor="#FF0000"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

For Change Text colour
 
#FF0000 
 mean  Red = FF(in hex ) Green = 00  Blue = 00  ( FF hex = 255 decimal )
 
Download Sourcecode in Full Project here !