Material Components

Material Components

Material Components for Android

Create beautiful apps with modular and customizable UI components.

  • Accurate & up to date

    Implement Material Design with pixel-perfect components, maintained by Google engineers and designers

  • Latest Android APIs

    Access components that use of the latest Android APIs and features, with graceful degradation for older Android versions

  • Industry standards

    Take advantage of the same components used in Google’s Android apps, which meet industry standards for internationalization and accessibility

Material Components for Android

Material Components for Android provides modular and customizable UI components to help developers easily create beautiful apps.

Getting Started

  1. Modify build.gradle

    To use the Material Components library with the Gradle build system, include the library in the build.gradle dependencies for your app.

    dependencies {
      compile 'com.android.support:design:[Library version code]'
    }
    
  2. Update your Layout

    Add a reference to the component (widget) that you want to use in your XML layout. (You can also dynamically instantiate a widget in Java.)

    <android.support.design.widget.FloatingActionButton android:id="@id/fab" />
    
  3. Use the Component

    You can then reference that widget in your Java class. First import it,

    import android.support.design.widget.FloatingActionButton;
    

    then use it.

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        // Do something!
      }
    });
    
  4. What’s next?