Update your app theme to inherit from one of these themes:
Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
For example:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
Note: Using a Material Components theme enables a custom view inflater
Source:
https://www.material.io/develop/android/docs/getting-started/