0% found this document useful (0 votes)
13 views1 page

Android Checkbox Layout Example

The document is an XML layout file for an Android application that defines a user interface with a LinearLayout containing multiple CheckBoxes and a TextView. It uses ConstraintLayout attributes for positioning and includes imports for necessary Android classes. The MainActivity class sets up the layout and applies window insets for proper display on devices with system bars.

Uploaded by

Pratiksha Wagh
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)
13 views1 page

Android Checkbox Layout Example

The document is an XML layout file for an Android application that defines a user interface with a LinearLayout containing multiple CheckBoxes and a TextView. It uses ConstraintLayout attributes for positioning and includes imports for necessary Android classes. The MainActivity class sets up the layout and applies window insets for proper display on devices with system bars.

Uploaded by

Pratiksha Wagh
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/ 1

Practical no 11 app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"
<?xml version="1.0" encoding="utf-8"?> app:layout_constraintTop_toTopOf="parent"
<androidx.constraintlayout.widget.ConstraintLayou app:layout_constraintVertical_bias="0.888" />
t </androidx.constraintlayout.widget.ConstraintLayo
xmlns:android="http://schemas.android.com/apk/re ut>
s/android"
xmlns:app="http://schemas.android.com/apk/res- package com.example.checkbox;
auto" import android.os.Bundle;
xmlns:tools="http://schemas.android.com/tools" import androidx.activity.EdgeToEdge;
android:id="@+id/main" import
android:layout_width="match_parent" androidx.appcompat.app.AppCompatActivity;
android:layout_height="match_parent" import androidx.core.graphics.Insets;
tools:context=".MainActivity"> import androidx.core.view.ViewCompat;
<LinearLayout import androidx.core.view.WindowInsetsCompat;
android:id="@+id/linearLayout" public class MainActivity extends
android:layout_width="242dp" AppCompatActivity {
android:layout_height="262dp" @Override
android:layout_marginBottom="232dp" protected void onCreate(Bundle
android:orientation="vertical" savedInstanceState) {
super.onCreate(savedInstanceState);
app:layout_constraintBottom_toBottomOf="parent EdgeToEdge.enable(this);
" setContentView(R.layout.activity_main);
app:layout_constraintEnd_toEndOf="parent"
ViewCompat.setOnApplyWindowInsetsListener(fin
app:layout_constraintStart_toStartOf="parent"> dViewById(R.id.main), (v, insets) -> {
<CheckBox Insets systemBars =
android:id="@+id/checkBox" insets.getInsets(WindowInsetsCompat.Type.system
android:layout_width="match_parent" Bars());
android:layout_height="wrap_content" v.setPadding(systemBars.left,
android:text="MAD" /> systemBars.top, systemBars.right,
<CheckBox systemBars.bottom);
android:id="@+id/checkBox2" return insets;
android:layout_width="match_parent" }); }}
android:layout_height="wrap_content"
android:text="PWP" />
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ETI" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="EDE" />
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="MAN" />
</LinearLayout>
<TextView
android:id="@+id/textView"
android:layout_width="191dp"
android:layout_height="48dp"
android:text="Select your fav subject"

app:layout_constraintBottom_toTopOf="@+id/line
arLayout"

You might also like