0% found this document useful (0 votes)
7 views2 pages

Practical No 10-1

The document contains XML layout code for an Android application, defining a user interface with TextViews, EditTexts, and a Button for a login screen. It also includes Java code for the MainActivity class, which sets up the layout and handles window insets for edge-to-edge display. The layout constraints ensure proper positioning of UI elements within the parent view.

Uploaded by

Kolekar Yashraj
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)
7 views2 pages

Practical No 10-1

The document contains XML layout code for an Android application, defining a user interface with TextViews, EditTexts, and a Button for a login screen. It also includes Java code for the MainActivity class, which sets up the layout and handles window insets for edge-to-edge display. The layout constraints ensure proper positioning of UI elements within the parent view.

Uploaded by

Kolekar Yashraj
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/ 2

Practical No 10:

XML Code: app:layout_constraintBottom_toBottomOf="p


arent"
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintL
app:layout_constraintEnd_toEndOf="parent"
ayout
app:layout_constraintHorizontal_bias="0.507"
xmlns:android="http://schemas.android.com/
apk/res/android"
app:layout_constraintStart_toEndOf="@+id/t
extView"
xmlns:app="http://schemas.android.com/apk/
res-auto"
app:layout_constraintTop_toTopOf="parent"

xmlns:tools="http://schemas.android.com/too
app:layout_constraintVertical_bias="0.039" />
ls"
android:id="@+id/main"
<TextView
android:layout_width="match_parent"
android:id="@+id/textView2"
android:layout_height="match_parent"
android:layout_width="wrap_content"
tools:context=".MainActivity">
android:layout_height="wrap_content"
android:text="Password"
<TextView
android:textSize="24sp"
android:id="@+id/textView"
android:layout_width="wrap_content"
app:layout_constraintBottom_toBottomOf="p
android:layout_height="wrap_content"
arent"
android:text="Username"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintBottom_toBottomOf="p
app:layout_constraintHorizontal_bias="0.059"
arent"
app:layout_constraintStart_toStartOf="parent
app:layout_constraintEnd_toEndOf="parent"
"

app:layout_constraintHorizontal_bias="0.052"
app:layout_constraintTop_toTopOf="parent"

app:layout_constraintStart_toStartOf="parent
app:layout_constraintVertical_bias="0.171" />
"
<EditText
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/editTextText2"
android:layout_width="wrap_content"
app:layout_constraintVertical_bias="0.057" />
android:layout_height="wrap_content"
android:ems="10"
<EditText
android:inputType="text"
android:id="@+id/editTextText"
android:layout_width="wrap_content"
app:layout_constraintBottom_toBottomOf="p
android:layout_height="wrap_content"
arent"
android:ems="10"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
protected void onCreate(Bundle
app:layout_constraintStart_toEndOf="@+id/t savedInstanceState) {
extView2" super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
app:layout_constraintTop_toBottomOf="@+id setContentView(R.layout.activity_main);
/editTextText"
ViewCompat.setOnApplyWindowInsetsListene
app:layout_constraintVertical_bias="0.058" /> r(findViewById(R.id.main), (v, insets) -> {
Insets systemBars =
<Button
android:id="@+id/button" insets.getInsets(WindowInsetsCompat.Type.sy
android:layout_width="wrap_content" stemBars());
android:layout_height="wrap_content" v.setPadding(systemBars.left,
android:text="Login" systemBars.top,
systemBars.right,
app:layout_constraintBottom_toBottomOf="p systemBars.bottom);
arent" return insets;
});
app:layout_constraintEnd_toEndOf="parent" }
}
app:layout_constraintHorizontal_bias="0.498"

app:layout_constraintStart_toStartOf="parent Output:
"

app:layout_constraintTop_toTopOf="parent"

app:layout_constraintVertical_bias="0.393" />
</androidx.constraintlayout.widget.Constraint
Layout>

Java Code:
package com.example.practicalno10;

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

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