Uses the correct CSS classes, and names each of the steps. The last two steps were merged, and we added in a click handler. PiperOrigin-RevId: 155561692
2.7 KiB
{% contentfor benefits %}
-
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
{% endcontentfor %}
Material Components for Android
Material Components for Android provides modular and customizable UI components to help developers easily create beautiful apps.
Getting Started
-
{: .step-list-item } ### 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]' } -
{: .step-list-item } ### 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" /> -
{: .step-list-item } ### 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! } }); -
{: .step-list-item } ### What's next?