android - Android:即使迁移到 Android X,也无法在我的设计中使用 TabLayout
问题描述
如果我在这里遗漏了一些明显的东西,我很抱歉,但是我将我的项目迁移到了 android X 并且仍然无法在我的布局文件中使用 TabLayout。
我在 build.grade (应用程序级别)中的依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.airbnb.android:lottie:3.3.1'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
我还尝试添加:
implementation 'com.android.support:design:27.1.0'
然后 Android Studio 将其标记为错误并告诉我升级到 Android X(我已经这样做了)
如果重要的话,我的编译 sdk 版本是 29 构建工具:29.0.2
提前致谢
解决方案
使用implementation 'com.google.android.material:material:1.0.0'
. 它包括 Tablayout