Resource Layouts

Following Contents are listed here.                                                                                                       

1. Layout Xml file. This is a Listview layout showing list of items with image.
2; Graphical Layout of xml file.
3. Description of attributes used.

Layout of Some Pages.

Following are the list of some  layouts that show the layouts and UI defined for that page.

File Name: Activity_Main.xml

scr11

File Name:Activity_List.xml

image

 

File name:login_activity,xml

image

 


Layout Xml File:Activity_list.xml                                                                                                                                      

 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools          ="http://schemas.android.com/tools"
    android:layout_width ="match_parent"
    android:layout_height="match_parent"
    android:background   ="@color/ltblue"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft  ="@dimen/activity_horizontal_margin"
    android:paddingRight ="@dimen/activity_horizontal_margin"
    android:paddingTop   ="@dimen/activity_vertical_margin"
    tools:context        ="com.example.project12.Listviewpage" >

    <LinearLayout
        android:id="@+id/LinearLayoutmain"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/LinearLayoutheader"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/btnor"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:text="@string/Listpage" />

            <LinearLayout
                android:id="@+id/Linearsort"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal" >

                <ImageView
                    android:id="@+id/imageButton3"
                    android:layout_width="20sp"
                    android:layout_height="20sp"
                    android:layout_marginLeft="10sp"
                    android:onClick="imagesize"
                    android:scaleType="fitXY"
                    android:src="@drawable/imagesize" />

                <TextView
                    android:id="@+id/username3"
                    android:layout_width="100sp"
                    android:layout_height="20sp"
                    android:layout_marginLeft="10sp"
                    android:layout_toRightOf="@+id/imageButton3"
                    android:foreground="#FFFFFF"
                    android:text="Not Loggedin"
                    android:textSize="12sp" />

                <ImageView
                    android:id="@+id/imageButton1"
                    android:layout_width="20sp"
                    android:layout_height="20sp"
                    android:layout_marginLeft="100sp"
                    android:onClick="up"
                    android:scaleType="fitXY"
                    android:src="@drawable/up" />

                <ImageView
                    android:id="@+id/imageButton2"
                    android:layout_width="20sp"
                    android:layout_height="20sp"
                    android:layout_marginLeft="1sp"
                    android:onClick="down"
                    android:scaleType="fitXY"
                    android:src="@drawable/down" />
            </LinearLayout>
        </LinearLayout>

        <ListView
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="450sp"
            android:layout_above="@+id/button1"
            android:layout_alignLeft="@+id/textView1"
            android:layout_below="@+id/textView1"
            android:scrollIndicators="top"
            android:scrollbars="vertical" >
        </ListView>
    </LinearLayout>

    <Button
        android:id="@+id/prevpage"
        android:layout_width="100sp"
        android:layout_height="30sp"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="90dp"
        android:background="@drawable/btnor"
        android:onClick="fnfinish"
        android:text="@string/prevpage"
        android:textSize="15sp" />

</RelativeLayout>


The Above layout will display the following Graphical Layout                                        

List View XML Layout in Eclipse while development. View of ListView with data on Mobile Application.
 
 

Attributes Details
Sl No
Attribute
Description
1.
<LinearLayout>                                       
Align more than one tag in columns and each <linearLayout> as one row. LinearLayout as Horizontal or Vertical.
2.
android:layout_alignParentBottom="true"
To align at bottom of page use.
3.
android:id                                                
Resource ID. A unique resource name for the element.
4.
android:layout_toRightOf                        
Align the element at the right of previous element.
5.
android:layout_height                              
( Required ) The height for the group, as a dimension value/or a keyword  as fill_parent/ wrap_content/ match_parent.
6.
android:layout_width                               
( Required ) The width for the group, as a dimension value /or a keyword as fill_parent/ wrap_content/ match_parent.
7.
<requestFocus>                                     
It gives its parent initial focus on the screen. We can have only one of these elements per file.
8.
android:background="@color/ltblue
Define Background Colors
9.
android:foreground="#FFFFFF"            
Define foreground color.
10.
android:onClick="fnfinish
Click to execute method name fnfinish()
11,
android:scaleType="fitXY"                      
Options for scaling the bounds of an image. This will fit full to image boundary.



AndroidManifest.xml                                                                                                                            
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="
http://schemas.android.com/apk/res/android"
    package="com.example.cart"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:name=".GlobalVariable"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ListActivity"
            android:label="@string/title_activity_list" >
        </activity>
        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login"
            android:theme="@style/Theme.AppCompat.Dialog" >
        </activity>
        <activity
            android:name=".CartActivity"
            android:label="@string/title_activity_cart" >
        </activity>
        <activity
            android:name=".ToastActivity"
            android:label="@string/title_activity_toast" >
        </activity>
        <activity
            android:name=".TestActivity"
            android:label="@string/title_activity_test" >
        </activity>
        <activity
            android:name=".MainActivity1"
            android:label="@string/title_activity_main" >
        </activity>
        <activity
            android:name=".ViewActivity"
            android:label="@string/title_activity_view" >
        </activity>
        <activity
            android:name=".Globalfunction"
            android:label="@string/title_activity_view" >
        </activity>
        <activity
            android:name=".SmsActivity"
            android:label="@string/title_activity_sms" >
        </activity>
        <activity
            android:name=".ComplaintActivity"
            android:label="@string/title_activity_complaint" >
        </activity>
    </application>

</manifest>