0% found this document useful (0 votes)
10 views16 pages

Exp7 MAD

The document contains two Android layout files (activity_main.xml) for different applications, one for a login page and another for student information. Each layout includes TextViews, EditTexts, and a Button, with specific attributes for styling and positioning. Additionally, both applications have a MainActivity.java file that sets up the layout and handles window insets for edge-to-edge display.

Uploaded by

lesplesp008
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)
10 views16 pages

Exp7 MAD

The document contains two Android layout files (activity_main.xml) for different applications, one for a login page and another for student information. Each layout includes TextViews, EditTexts, and a Button, with specific attributes for styling and positioning. Additionally, both applications have a MainActivity.java file that sets up the layout and handles window insets for edge-to-edge display.

Uploaded by

lesplesp008
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/ 16

Name:- Ankita Pujari

Roll_No:- 243324
Batch:- T5

Activity_main.XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="...LOGIN PAGE..."
android:textSize="40dp"
android:textStyle="bold"
android:layout_marginTop="50dp"
android:layout_marginLeft="50dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" USERNAME "
android:textSize="30dp"
android:textStyle="bold"
android:layout_marginLeft="100dp"
android:layout_marginTop="70dp"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="80dp"
android:text="PASSWORD"
android:textSize="30dp"
android:textStyle="bold" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="20dp"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="100dp"
android:text="SUBMIT"
android:textSize="40dp"
android:textStyle="bold" />
</LinearLayout>

MainActivity.java
package com.example.exp7_1;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main),
(v, insets) -> {
Insets systemBars =
insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right,
systemBars.bottom);
return insets;
});
}
}
Output:-
Activity_main.XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="..Student Info.."
android:textSize="40dp"
android:textStyle="bold"
android:layout_marginTop="50dp"
android:layout_marginLeft="50dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="150dp"
android:text=" Student Name "
android:textSize="30dp"
android:textStyle="bold" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="200dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="250dp"
android:text="Enrollment No."
android:textSize="30dp"
android:textStyle="bold" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:layout_marginLeft="30dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="350dp"
android:text=" Department Name "
android:textSize="30dp"
android:textStyle="bold" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="400dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:layout_marginTop="450dp"
android:text="Year"
android:textSize="30dp"
android:textStyle="bold" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="500dp"
android:layout_marginLeft="20dp"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="140dp"
android:layout_marginTop="600dp"
android:text="SUBMIT"
android:textSize="30dp"
android:textStyle="bold" />

</RelativeLayout>

MainActivity.java
package com.example.exp7_2;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main),
(v, insets) -> {
Insets systemBars =
insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right,
systemBars.bottom);
return insets;
});
}
}

Output:-

You might also like