0% found this document useful (0 votes)
11 views8 pages

PR 6

The document outlines a practical exercise for developing Android applications using different layout types, specifically TableLayout and FrameLayout. It includes code snippets for displaying student information in a table format and demonstrating various data types in object-oriented programming. The document specifies the structure of the MainActivity.java and activity_main.xml files for the implementation.

Uploaded by

Shivraj Chougule
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)
11 views8 pages

PR 6

The document outlines a practical exercise for developing Android applications using different layout types, specifically TableLayout and FrameLayout. It includes code snippets for displaying student information in a table format and demonstrating various data types in object-oriented programming. The document specifies the structure of the MainActivity.java and activity_main.xml files for the implementation.

Uploaded by

Shivraj Chougule
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/ 8

Name: Shivraj Prakash Chougule Enrolment No.

: 2215770083
Batch: T1 Roll No.: 12

Practical No. 6: Develop a program to implement frame layout, table layout and relative
layout.

X. Exercise
1. Write a program to display 10 students’ basic information in a table form using Table
layout.

Program (MainActivity.java) – <?xml

version="1.0" encoding="utf-8"?>

<TableLayout 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:gravity="top|center"

android:outlineAmbientShadowColor="@color/black">

<TableRow> <TextView

android:text="Sr. no"
android:layout_weight="1"
android:textStyle="bold"/>

<TextView

android:text="Name of Student"

android:layout_weight="1"

android:textStyle="bold"/>

<TextView
android:text="Age"
android:layout_weight="1"
android:textStyle="bold"/>
</TableRow>

<TableRow> <TextView
android:text="1"
android:layout_weight="1"/>

<TextView
android:text="Tushar Neje"
android:layout_weight="1"/>

<TextView
android:text="18"
android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView

android:text="2"
android:layout_weight="1"/>
<TextView
android:text="Kiran Shiudkar"

android:layout_weight="1"/>
<TextView android:text="19"
android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView
android:text="3"
android:layout_weight="1"/>

<TextView
android:text="Rushabh Zore"
android:layout_weight="1"/>
<TextView

android:text="18"
android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView
android:text="4"
android:layout_weight="1"/>

<TextView
android:text="Omkar Mali"
android:layout_weight="1"/>

<TextView
android:text="18"
android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView

android:text="5"
android:layout_weight="1"/>
<TextView

android:text="Sushant Khadake"
android:layout_weight="1"/>
<TextView android:text="18"
android:layout_weight="1"/>

</TableRow>

<TableRow>
<TextView
android:text="6"
android:layout_weight="1"/>

<TextView
android:text="Sandesh Pol"
android:layout_weight="1"/>
<TextView

android:text="18"
android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView

android:text="7"
android:layout_weight="1"/>
<TextView android:text="Irfan

Naikwade"
android:layout_weight="1"/>
<TextView android:text="18"

android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView

android:text="8"
android:layout_weight="1"/>
<TextView

android:text="Vinayak Mali"
android:layout_weight="1"/>
<TextView

android:text="18"
android:layout_weight="1"/>
</TableRow>

<TableRow> <TextView
android:text="9"
android:layout_weight="1"/>

<TextView

android:text="Ram Kumar"
android:layout_weight="1"/>

<TextView
android:text="18"

android:layout_weight="1"/>

</TableRow>

<TableRow> <TextView
android:text="10"
android:layout_weight="1"/>

<TextView
android:text="Raj Kambale"

android:layout_weight="1"/>

<TextView
android:text="18"
android:layout_weight="1"/>

</TableRow>

</TableLayout> Program

(activity_main.xml) –

package com.example.androidapplication_pat6;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

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

Output –

2. Write a program to display all the data types in object-oriented programming using
Frame layout.

Program (MainActivity.java) –

<FrameLayout 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:gravity="top|center"
android:outlineAmbientShadowColor="@color/black">

<TextView
android:layout_width="203dp"
android:layout_height="200dp"
android:layout_gravity="top|start"
android:gravity="center" android:text="Integer"
android:textColor="#000"
android:textSize="20dp"/>
<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="top|end" android:gravity="center"
android:text="Floating-point" android:textColor="#000"
android:textSize="20dp"/>

<TextView
android:layout_width="203dp"
android:layout_height="200dp"
android:layout_gravity="center|start"
android:gravity="center"
android:text="Boolean"
android:textColor="#000"
android:textSize="20dp"/>

<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center|end"
android:gravity="center"
android:text="Character"
android:textColor="#000"
android:textSize="20dp"/>

<TextView
android:layout_width="203dp"
android:layout_height="200dp"
android:layout_gravity="bottom|start"
android:gravity="center"
android:text="Array"
android:textColor="#000"
android:textSize="20dp"/>

<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="bottom|end"
android:gravity="center"
android:text="Class"
android:textColor="#000"
android:textSize="20dp"/>
</FrameLayout>
Program (activity_main.xml) –

Output –

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy