【发布时间】:2020-11-11 05:25:29
【问题描述】:
我无法让 TabLayout 解决。我已经尝试实现其他人为此问题推荐的所有依赖项,但它仍然无法正常工作。任何人都可以帮忙吗?是我试图在 Androidx 旁边使用旧功能的问题吗?谢谢
第一部分: build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.instagramclone"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Design
implementation 'com.android.support:support-compat:30.0.0'
implementation "com.android.support:support-core-utils:30.0.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
implementation "com.android.support:design:30.0.0"
}
第二部分:XML 文件
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true">
<com.google.android.material.appbar.AppBarLayout
android:layout_width='match_parent'
android:layout_height = 'wrap_content'>
<android.support.design.widget.TabLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/tabs"
android:background="@drawable/white_grey_border_bottom">
</android.support.design.widget.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
</RelativeLayout>
</merge>
【问题讨论】:
-
清理、重建、清除 gradle 的缓存
标签: android android-layout android-widget android-tablayout material-components-android