0% found this document useful (0 votes)
37 views9 pages

Practical No.6

The document provides XML layouts for three different Android layout types: Table Layout, Frame Layout, and Relative Layout. The Table Layout displays a list of students with their names, roll numbers, and ages, while the Frame Layout showcases various data types in OOP. The Relative Layout includes a simple sign-in form with username and password fields, along with a login button.
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)
37 views9 pages

Practical No.6

The document provides XML layouts for three different Android layout types: Table Layout, Frame Layout, and Relative Layout. The Table Layout displays a list of students with their names, roll numbers, and ages, while the Frame Layout showcases various data types in OOP. The Relative Layout includes a simple sign-in form with username and password fields, along with a login button.
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/ 9

Practical No.

6:Develop a Program to Implement Frame Layout, Table Layout


and Relative Layout.
Table Layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:id="@+id/main">
<android.widget.TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:padding="8dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#4CAF50">
<TextView
android:text="Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:padding="8dp"/>
<TextView
android:text="Roll No."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:padding="8dp"/>
<TextView
android:text="Age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Payal Jadhav" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="47" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Arya Kadam" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="46" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="19" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Riya Kadam" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="48" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Tanishka Jadhav" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="19" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Payal Dhamal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="56" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Manasi Bhosale" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="57" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Manasi Chavan" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="45" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="19" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Sakshi Jagtap" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="56" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Sakshi Vare" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="49" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="20" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="Shravani Wadkar" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="43" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
<TextView android:text="19" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="8dp"/>
</TableRow>

</android.widget.TableLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
Frame Layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/main">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">

<TextView
android:id="@+id/textViewDataTypes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Data Types in OOP"
android:textSize="18sp"
android:textStyle="bold"/>

<TextView
android:id="@+id/textViewInteger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Integer: 123"
android:textSize="16sp"
android:layout_marginTop="50dp" />

<TextView
android:id="@+id/textViewFloat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Float: 12.34"
android:textSize="16sp"
android:layout_marginTop="100dp" />
<TextView
android:id="@+id/textViewString"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="String: Hello, OOP!"
android:textSize="16sp"
android:layout_marginTop="150dp" />

<TextView
android:id="@+id/textViewBoolean"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Boolean: true"
android:textSize="16sp"
android:layout_marginTop="200dp" />

<TextView
android:id="@+id/textViewObject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Object: Custom Object"
android:textSize="16sp"
android:layout_marginTop="250dp" />

</FrameLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
Relative Layout:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout

android:id="@+id/main"

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent">

<TextView

android:id="@+id/textView3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge"

android:text="SIGN IN"

android:layout_alignParentTop="true"

android:layout_centerHorizontal="true" />

<TextView

android:id="@+id/userName"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="16dp"

android:layout_marginTop="110dp"

android:text="UserName:"

android:textColor="#000000"

android:textSize="20sp" />

<EditText

android:id="@+id/edt_userName"

android:layout_width="0dp"

android:layout_height="40dp"
android:layout_toRightOf="@id/userName"

android:layout_marginLeft="8dp"

android:layout_marginRight="16dp"

android:layout_alignBaseline="@id/userName"

android:layout_alignParentRight="true"

android:hint="User Name" />

<TextView

android:id="@+id/password"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/userName"

android:layout_marginLeft="16dp"

android:layout_marginTop="20dp"

android:text="Password:"

android:textColor="#000000"

android:textSize="20sp" />

<EditText

android:id="@+id/edt_password"

android:layout_width="0dp"

android:layout_height="40dp"

android:layout_toRightOf="@id/password"

android:layout_marginLeft="8dp"

android:layout_marginRight="16dp"

android:layout_alignBaseline="@id/password"

android:layout_alignParentRight="true"

android:hint="Password"

android:inputType="textPassword" />

<Button
android:id="@+id/btnLogin"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/password"

android:layout_centerHorizontal="true"

android:layout_marginTop="20dp"

android:background="#03B424"

android:text="Login"

android:textColor="#ffffff"

android:textStyle="bold" />

</RelativeLayout>

You might also like