Android - TabLayout in AndroidX

杀马特。学长 韩版系。学妹 提交于 2020-01-24 19:57:45

问题


I just tried to implement tabLayout on Android with androidX and im not able to do it.

Is tabLayout on androidX deprecated?


回答1:


You need to add material library as a dependency to build.gradle file to use TabLayout

dependencies {
    implementation 'com.google.android.material:material:1.0.0'
}

also inclue google() maven repository to the repositories section of the root build.gradle

allprojects {
    repositories {
      google()
      jcenter()
    }
}

You can read the Getting started with Material Components for Android to learn more about the library.




回答2:


TabLayout belongs to Maven artifact com.android.support:design:$version

if you want to use TabLayout in androidX you need to add material library

Ref : https://developer.android.com/jetpack/androidx/migrate

Ref : https://developer.android.com/jetpack/androidx/migrate/artifact-mappings

so you need to add implementation 'com.google.android.material:material:1.0.0' in dependency.

dependencies {
    implementation 'com.google.android.material:material:1.0.0'
}


来源:https://stackoverflow.com/questions/58177134/android-tablayout-in-androidx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!