Material Design Basics
Use Material Components: MaterialButton, TextInputLayout, MaterialCardView, FloatingActionButton, Snackbar, Chip, BottomSheetDialog, and Dynamic Color.
Material Design Basics is a free Android Academy lesson on CoddyKit — lesson 1 of 5. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Android Academy learning path, one of 5 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Material Design?
Material Design is Google's design system for building beautiful, consistent Android apps. It provides:
- A rich set of pre-built UI components
- Consistent spacing, typography, and color rules
- Accessible and responsive components
- Built-in animations and transitions
The Material Components for Android library (MDC) brings Material 3 to Jetpack.
Adding Material Components
Add the dependency and set your app theme to a Material theme:
// app/build.gradle:
dependencies {
implementation 'com.google.android.material:material:1.12.0'
}
// res/values/themes.xml:
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorSecondary">@color/secondary</item>
<!-- ... -->
</style>MaterialButton
Replace the plain Button with MaterialButton for rounded corners, ripple effects, and icon support:
<!-- Filled (default) -->
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
app:icon="@drawable/ic_save" />
<!-- Outlined style -->
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
<!-- Text button -->
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.TextButton"
android:text="Learn more" />TextInputLayout & TextInputEditText
TextInputLayout wraps an EditText to provide floating labels, error messages, and character counters:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilEmail"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email address"
app:helperText="We will never share your email">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>MaterialCardView
MaterialCardView adds elevation, rounded corners, and stroke to a container:
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="12dp"
app:cardElevation="4dp"
app:strokeColor="@color/outline"
app:strokeWidth="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:orientation="vertical">
<TextView android:text="Card Title" />
<TextView android:text="Card content goes here" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>FloatingActionButton (FAB)
FABs highlight the primary action on a screen. Material 3 offers three sizes:
<!-- Standard FAB -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="Add item"
app:srcCompat="@drawable/ic_add" />
<!-- Extended FAB (icon + text) -->
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:text="New Note"
app:icon="@drawable/ic_edit"
android:layout_gravity="bottom|end" />MaterialToolbar
Replace the default ActionBar with MaterialToolbar for Material 3 styling:
<!-- In layout XML -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorSurface"
app:title="My App"
app:navigationIcon="@drawable/ic_menu" />
// In Activity:
setSupportActionBar(binding.toolbar)
binding.toolbar.setNavigationOnClickListener {
onBackPressedDispatcher.onBackPressed()
}Snackbar
Snackbar shows brief, actionable messages at the bottom of the screen. Prefer it over Toast:
// Simple message:
Snackbar.make(binding.root, "Item deleted", Snackbar.LENGTH_SHORT).show()
// With action:
Snackbar.make(binding.root, "Item deleted", Snackbar.LENGTH_LONG)
.setAction("Undo") {
viewModel.undoDelete()
}
.setAnchorView(binding.fab) // appears above the FAB
.show()Chip & ChipGroup
Chips are compact elements for filters, tags, and selections:
<com.google.android.material.chip.ChipGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:singleSelection="true">
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Kotlin"
style="@style/Widget.Material3.Chip.Filter" />
<com.google.android.material.chip.Chip
android:text="Android"
style="@style/Widget.Material3.Chip.Filter" />
<com.google.android.material.chip.Chip
android:text="Jetpack"
style="@style/Widget.Material3.Chip.Filter" />
</com.google.android.material.chip.ChipGroup>BottomSheetDialog
A Modal Bottom Sheet slides up from the bottom and contains content or actions:
class OptionsBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.bottom_sheet_options, container, false)
}
}
// Show it from a Fragment:
val sheet = OptionsBottomSheet()
sheet.show(parentFragmentManager, "options")Material You — Dynamic Color
Android 12+ supports Dynamic Color — the app's color scheme adapts to the user's wallpaper automatically:
// In Application.onCreate():
override fun onCreate() {
super.onCreate()
DynamicColors.applyToActivitiesIfAvailable(this)
}
// That's it! Colors automatically extract from wallpaper on Android 12+
// On older Android, fallback colors from your theme are used.Quick Check
Which Material component should you use to wrap an EditText to get floating labels and inline error messages?
Recap: Material Design Basics
Material Components make beautiful apps easy:
MaterialButton— filled, outlined, text stylesTextInputLayout+TextInputEditText— floating labels, errorsMaterialCardView— cards with elevation and strokeFloatingActionButton— primary action buttonSnackbar— dismissible messages with actionsChip— tags, filters, selections- Dynamic Color — adapts to wallpaper on Android 12+
Next: themes, styles, and dark mode.
Frequently asked questions
Is the “Material Design Basics” lesson free?
Yes — the full text of “Material Design Basics” is free to read here on the web, and the Android Academy course includes 5 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Android Academy course, upgrade to CoddyKit PRO.
What will I learn in “Material Design Basics”?
Use Material Components: MaterialButton, TextInputLayout, MaterialCardView, FloatingActionButton, Snackbar, Chip, BottomSheetDialog, and Dynamic Color. You practise Android Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Android Academy?
No prior experience is required. Android Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 5, so you can start here or from the beginning and move at your own pace.
How long does the “Material Design Basics” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Android Academy lesson?
Yes. Every Android Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Material Design Basics
- Themes & Styles
- Custom Views
- Animations & Transitions
- Bottom Navigation & Tabs