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

Advanced Android ConstraintLayout Pack

The document provides code examples for creating a login screen using ConstraintLayout in Android, including XML layout and Kotlin code for input validation. It also includes a RecyclerView setup for displaying a modern list UI and a CardView design for a modern card interface. Each section contains both XML and Kotlin snippets to illustrate the implementation of these UI components.

Uploaded by

singhaniket79327
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)
2 views2 pages

Advanced Android ConstraintLayout Pack

The document provides code examples for creating a login screen using ConstraintLayout in Android, including XML layout and Kotlin code for input validation. It also includes a RecyclerView setup for displaying a modern list UI and a CardView design for a modern card interface. Each section contains both XML and Kotlin snippets to illustrate the implementation of these UI components.

Uploaded by

singhaniket79327
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

Advanced Android Pack - ConstraintLayout &

Modern UI

1. Login Screen (ConstraintLayout)

XML:

<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:id="@+id/email"
android:hint="Email"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<EditText
android:id="@+id/password"
android:hint="Password"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/email"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<Button
android:text="Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

</[Link]>

Kotlin:

val email = findViewById<EditText>([Link])


val password = findViewById<EditText>([Link])

if([Link]().isEmpty()){
[Link] = "Enter Email"
}

2. RecyclerView Modern List UI

XML:

<[Link]
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

Kotlin:

val list = listOf("Item1","Item2")


[Link] = MyAdapter(list)
3. Card UI Design
XML:

<[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="12dp">

<TextView
android:text="Modern Card UI"
android:padding="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</[Link]>

You might also like