0% found this document useful (0 votes)
44 views3 pages

pr6 Table Layout

The document describes the XML layout and Java code for an Android application that displays student data in a table layout. The XML layout defines a linear layout containing a table layout with rows for column headers and student records. The Java code is a basic activity class that inflates the XML layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views3 pages

pr6 Table Layout

The document describes the XML layout and Java code for an Android application that displays student data in a table layout. The XML layout defines a linear layout containing a table layout with rows for column headers and student records. The Java code is a basic activity class that inflates the XML layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ketan Raju Sarode

Practical 6.2 TABLE LAYOUT

 Activity_main.xml:

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="SR NO."
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="NAME"
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="BRANCH"
android:padding="8dp"
android:gravity="center"/>
</TableRow>
<TableRow>
<TextView
android:text="1"
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="Ketan Sarode "
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="CM"
android:padding="8dp"
android:gravity="center"/>
</TableRow>
<TableRow>
<TextView
android:text="2"
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="Mohit Patil"
android:padding="8dp"
android:gravity="center"/>
<TextView
android:text="IT"
android:padding="8dp"
android:gravity="center"/>
</TableRow>
</TableLayout>
</LinearLayout>
Ketan Raju Sarode

 Mainactivity.java:

package com.example.pr6_table_layout;

import android.os.Bundle;

import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;

import android.view.View;

import androidx.core.view.WindowCompat;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.example.pr6_table_layout.databinding.ActivityMainBinding;

import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

private AppBarConfiguration appBarConfiguration;


private ActivityMainBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
}
}
Ketan Raju Sarode

You might also like