100KDroid : AbsoluteLayout :In Android

Hello World!!!!!

AbsoluteLayout :In Android

Using Absolute Layout in Android:: 
This Tutorial describes how to use AbsoluteLayout in Android.In this example we have simply created a TextView using AbsoluteLayout,which you can modify according to your requirements. For this tutorial Android 17 used. 

What is AbsoluteLayout and How we can use it in Android? 

AbsoluteLayout:-A layout that lets you specify exact locations (x/y coordinates) of its children. Absolute layouts are less flexible and harder to maintain than other types of layouts without absolute positioning.


                                          DOWNLOAD ZIP

Source Code AbsoluteLayout Example::
1.Create Android Application Project named it as a AbsoluteLayout in Eclipse. 
2.In this we have a java class in src folder and an activity file which is by default activity_main.xml located in layout folder under res folder. 
3.Our next file will be AndroidManifest.xml file located in main folder. 
4.Below is the code given for all these three files i.e 
     4.1. First one is for activity_main.xml .
     4.2. Second one is for MainActivity.java . 
     4.3. Third one is for AndroidManifest.xml . 4.4. And in Last we have the output .


activity_main.xml::

activity_main.xml :: your main xml file
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Element One" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="30sp"
        android:layout_y="30sp"
        android:text="100KDroid"
        android:textSize="30sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="80sp"
        android:layout_y="80sp"
        android:text="Tutorials"
        android:textSize="30sp" />

</AbsoluteLayout>
MainActivity.java::
MainActivity.java :: your main java file
package com.shokeen.absolutelayout;

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

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}


AndroidManifest.xml::
AndroidManifest.xml :: your manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.shokeen.absolutelayout"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.shokeen.absolutelayout.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>
    </application>

</manifest>
Output::
Output of the AbsoluteLayout Android Project... ☺ ☺ ☺ ☺☻ ☻ ☻

Absolute Layout Output......!!!
Download::
 Download zip code for this android project::☺ ☺ ☺ ☺☻ ☻ ☻
Download zip code for this Android Project:


Like us::
Like us on Facebook :: 
☺ ☺ ☺ ☺☻ ☻ ☻


Have a good day......!!!

No comments:

Post a Comment

Copyright © 100KDroid Urang-kurai