【问题标题】:which library should i implement to use app:layout_behavior="@string/appbar_scrolling_view_behavior"我应该实现哪个库来使用 app:layout_behavior="@string/appbar_scrolling_view_behavior"
【发布时间】:2019-09-25 09:40:55
【问题描述】:

我想在 xml 文件中添加 app:layout_behavior 属性,但不支持。我应该在 gradle 文件中添加哪个库?

compile 'com.android.support:design:22.2.0

当我添加这个编译库时,android Studio 给出了错误,我必须使用 androidx 库来支持 app:layout_behavior

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.expensemanager"
        minSdkVersion 16
        targetSdkVersion 29
        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.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'com.google.firebase:firebase-auth:19.0.0'
    implementation 'com.google.firebase:firebase-database:19.1.0'
    implementation 'com.google.firebase:firebase-functions:19.0.1'
    implementation 'androidx.cardview:cardview:1.0.0'


}
apply plugin: 'com.google.gms.google-services'

请帮助我应该实施什么来支持app:layout_behavior

【问题讨论】:

  • 你不需要任何额外的库
  • 实现'com.google.android.material:material:1.0.0'

标签: android xml android-support-library android-design-library material-components-android


【解决方案1】:

使用 Material Components Library,它是 Android 设计支持库的直接替代品。

implementation 'com.google.android.material:material:1.1.0-beta02'

或最新的稳定版本:

implementation 'com.google.android.material:material:1.0.0'

【讨论】:

    猜你喜欢
    • 2018-06-16
    • 2016-05-12
    • 2012-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-22
    相关资源
    最近更新 更多