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

p6 Table Layout

The document describes an XML code for creating a table layout in Android. The table layout contains multiple rows with student information like roll number, name, marks and class. Each row contains textviews for displaying the data in individual cells. The table layout is centered with margins and a light gray background color. Student records for 5 students are added with details like student AAA having 90% marks in CO-6-I class.

Uploaded by

Parth Bhawar
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)
61 views9 pages

p6 Table Layout

The document describes an XML code for creating a table layout in Android. The table layout contains multiple rows with student information like roll number, name, marks and class. Each row contains textviews for displaying the data in individual cells. The table layout is centered with margins and a light gray background color. Student records for 5 students are added with details like student AAA having 90% marks in CO-6-I class.

Uploaded by

Parth Bhawar
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

Prac�cal No 6

Table Layout
XML Code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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"
android:orientation="vertical"
android:background="#ffffff"
tools:context=".MainActivity">

<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="30dp"
android:layout_marginHorizontal="10dp"
android:background="#f1f1f1">

<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Roll No"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Student Name"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Marks"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Class"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>
</TableRow>

<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="01"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
Prac�cal No 6
Table Layout
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAA"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="02"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BBB"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="91%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
Prac�cal No 6
Table Layout
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="03"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CCC"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="89%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="04"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
Prac�cal No 6
Table Layout
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DDD"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="96%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="05"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EEE"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="87%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
Prac�cal No 6
Table Layout
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="06"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FFF"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="82%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>
Prac�cal No 6
Table Layout

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="HHH"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="98%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="08"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="III"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="80%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
Prac�cal No 6
Table Layout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="JJJ"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="88%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow><TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginBottom="1dp"
android:layout_marginHorizontal="1dp"/>

<TextView
Prac�cal No 6
Table Layout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KKK"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="97%"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CO-6-I"
android:layout_weight="1"
android:gravity="center"
android:background="#ffffff"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"/>
</TableRow>
</TableLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

Java Code:

package com.example.tablelayout;

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);
}
}
Prac�cal No 6
Table Layout
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