Skip to content

Get Started

Configuration

  • In your app build.gradle, add another dependencies
    build.gradle
    android {
        ..
        // For using viewBinding
        buildFeatures {
            viewBinding true
        }  
    }
    dependencies {
        ...
        // To use material component
        implementation 'com.google.android.material:material:1.3.0'
    }
    
  • To use the default material component style, open your styles.xml file and set the AppTheme parent to Theme.MaterialComponents.NoActionBar, like this:
    styles.xml
    <resources>
        <!---Change AppTheme's parent to Theme.MaterialComponents.NoActionBar--->
        <style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    </resources>
    

Beside enable us to use material component style, it define that every activity created do not come with embedded Toolbar. So you must add Toolbar manually to your Activity's layout file.

After your Activity inherit DevActivity class, just call setupToolbar method to configure it.