android – Material TabLayout Access Issue-ThrowExceptions

Exception or error:

I am using support design version 28.0.0 in my app and trying to use material tablayout in XML.

com.google.android.material.tabs.TabLayout

unfortunatly i am unable to access it in XML. Any help is appreciated.

I have used
android.support.design.widget.TabLayout
but now i want to use material tablayout as per new documentation

https://developer.android.com/reference/com/google/android/material/tabs/TabLayout

How to solve:

You have to include the Material Components library in your app build.gradle file:

  • If you’re using androidx:
implementation 'com.google.android.material:material:1.0.0'
  • If you’re not:
implementation 'com.android.support:design:28.0.0-alpha3'

More information is available here: https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md

Leave a Reply

Your email address will not be published. Required fields are marked *