qq_36286039
CN-Dust
采纳率100%
2020-08-23 21:13

想要使用android.support.design.widget.BottomNavigationView,已经在gradle里添加了support.design语句,但是依然不能用??

  • 这是我想要使用android.support.design.widget.BottomNavigationView的地方,其中第一排的字全部是红的。。 <android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:attr/windowBackground" android:layout_alignParentBottom="true" app:menu="@menu/navigation" > </android.support.design.widget.BottomNavigationView>

* 图片说明

  • 然后以下是我的gradle……其中support.design是按照某位大佬说的,从小灯泡里添加的,不是手打的……不知道还缺啥,希望能有大佬帮帮忙……
  • 我这里手上还有一份老师发的可以运行的代码,应该不存在SDK的问题。。老师的代码里也包含android.support.design.widget.BottomNavigationView,可以完美运行,然而我的就怎么都不行(那一排字一直是红色的)
  • 求大佬解答QUQQQQ

图片说明

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "net.hnjdzy.myapplication"
        minSdkVersion 21
        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.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.2.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.0'
    implementation 'androidx.navigation:navigation-ui:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.mediarouter:mediarouter:1.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    //noinspection GradleCompatible
    implementation 'com.android.support:support-v4:28.0.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答