Saturday, 13 September 2014

Android forth lecture

 Fourth lecture

A code to make a page as follows:

  • Start a new project and give it a name of your choice.
  • Open res>layout>main.xml
  • Now write the following code:

<?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_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="User name"
        />
    <EditText 
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"/>
          
     <TextView 
         android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="Status"
        />
       <LinearLayout 
         android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="horizontal">
     <RadioButton 
         android:layout_height="wrap_content"
         android:layout_width="fill_parent"
         android:text="Male"
         android:layout_weight="1"/>
     <RadioButton 
         android:layout_height="wrap_content"
         android:layout_width="fill_parent"
         android:text="Female"
         android:layout_weight="1"/> 
         </LinearLayout>
         <LinearLayout 
         android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="vertical">
     <TextView 
         android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="City"
        />
        <Spinner 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"/>
        
        <TextView 
         android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="Course"/>
        </LinearLayout>
        <LinearLayout 
            android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="horizontal">
           
        <CheckBox 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="java"
            android:layout_weight="1"/>
        <CheckBox 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="android"
            android:layout_weight="1"/>
</LinearLayout>
<LinearLayout 
     android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="vertical"
    ></LinearLayout>
 <LinearLayout 
            android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="horizontal">
        
 <CheckBox 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="iphone"
            android:layout_weight="1"/>
        <CheckBox 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text=".net"
            android:layout_weight="1"/>
        ></LinearLayout>
        <LinearLayout 
            android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="horizontal"
        >
        <Button 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="Submit"
             android:layout_weight="1"
            />
        <Button 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="Cancel"
             android:layout_weight="1"
            />
         </LinearLayout>
          </LinearLayout>

  • Method to see the output of the above code is mentioned in the previous post i.e in android third lecture. 


No comments:

Post a Comment