Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views4 pages

Practical 5

The document provides XML code examples for implementing Linear and Absolute layouts in an Android application. It includes the structure for a login page with TextViews, EditTexts, and a Button in both layout types. The Linear layout organizes elements vertically, while the Absolute layout positions elements at specific coordinates on the screen.

Uploaded by

Payal Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Practical 5

The document provides XML code examples for implementing Linear and Absolute layouts in an Android application. It includes the structure for a login page with TextViews, EditTexts, and a Button in both layout types. The Linear layout organizes elements vertically, while the Absolute layout positions elements at specific coordinates on the screen.

Uploaded by

Payal Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No.

5 : Develop a program to Implement


Linear and Absolute layout
• Linear layout
<?xml version="1.0" encoding="utf-8"?> android:textStyle="italic"
<LinearLayout android:layout_marginLeft="20dp"
xmlns:android="http://schemas.android.com/ android:textSize="30dp"/>
apk/res/android"
<TextView
xmlns:app="http://schemas.android.com/apk android:layout_width="wrap_content"
/res-auto" android:layout_height="wrap_content"
android:text="password"
xmlns:tools="http://schemas.android.com/to android:textAlignment="center"
ols" android:layout_marginLeft="20dp"
android:id="@+id/main" android:textSize="40dp"
android:layout_width="match_parent" android:textColor="#6638e2"
android:layout_height="match_parent" android:textStyle="bold"
android:orientation="vertical"
android:showDividers="middle" />
android:divider="@color/black" <EditText
android:padding="80dp" android:layout_width="wrap_content"
tools:context=".MainActivity"> android:layout_height="wrap_content"
android:hint="Enter password"
<TextView android:textStyle="italic"
android:layout_width="wrap_content" android:layout_marginLeft="20dp"
android:layout_height="wrap_content" android:textSize="30dp"/>
android:text="Username"
android:textAlignment="center" <Button
android:layout_marginLeft="20dp" android:layout_width="wrap_content"
android:textSize="40dp" android:layout_height="wrap_content"
android:textColor="#6638e2" android:text="Submit"
android:textStyle="bold" android:textSize="30dp"
/>
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter username" </LinearLayout>
• Absolute layout
<?xml version="1.0" encoding="utf-8"?> android:layout_width="wrap_content"
<AbsoluteLayout android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/ android:text="Mobile no.:"
apk/res/android" android:textSize="30dp"
android:layout_y="200dp"
android:layout_x="30dp"
xmlns:app="http://schemas.android.com/apk/ res- />
auto"

xmlns:tools="http://schemas.android.com/too
ls" <EditText
android:id="@+id/main" android:layout_width="200dp"
android:layout_width="match_parent" android:layout_height="30dp"
android:layout_height="match_parent" android:layout_x="200dp"
tools:context=".MainActivity"> android:layout_y="100dp"
android:textSize="30dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" <EditText
android:text="Login Page!" android:layout_width="200dp"
android:textSize="40dp" android:layout_height="30dp"
android:textStyle="bold" android:textSize="30dp"
android:layout_x="100dp" android:layout_y="150dp"
android:layout_y="20dp" android:layout_x="200dp"
/>

/>
<EditText
android:layout_width="200dp"
<TextView android:layout_height="30dp"
android:layout_width="wrap_content" android:textSize="30dp"
android:layout_height="wrap_content" android:layout_y="200dp"
android:text="Username:" android:layout_x="200dp"
android:layout_x="30dp" />
android:layout_y="100dp" <Button
android:textSize="30dp" android:layout_width="wrap_content"
/> android:layout_height="wrap_content"
android:text="Submit"
android:textSize="30dp"
<TextView android:layout_y="250dp"
android:layout_width="wrap_content" android:layout_x="200dp"
android:layout_height="wrap_content" />
android:text="Email:"
android:textSize="30dp"
android:layout_y="150dp"
android:layout_x="30dp" </AbsoluteLayout>
/>

<TextView

Linear Layout Absolute layout

You might also like