Material Design.
CardView is easy. Here is the completed code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main">
<androidx.cardview.widget.CardView
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_margin="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
CardView
can be used with the androidx
namespace. Additionally, it uses elevation
to automatically lay out the box. Other View
s can go inside of it, or you can use ConstraintLayout to position elements at the same root level. Or you can nest TextView
s, for example.
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_margin="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="Welcome!"
app:layout_constraintStart_toStartOf="@id/cardView"
app:layout_constraintTop_toTopOf="@id/cardView" />
</androidx.cardview.widget.CardView>
Alert tutorial.
Material Design.
Stroke it.
Create beautiful buttons in XML.
Built with Android Studio and Kotlin.
Getting started is sometimes the hardest part.
Add a click listener in Kotlin.
Let users sign in.
It always begins with registration.