找不到属性fab附加

时间:2018-10-22 07:05:58

标签: android material-design

使用材料组件时无法运行项目。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'android.arch.lifecycle:extensions:1.1.1'

    implementation 'com.facebook.fresco:fresco:1.11.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
    implementation  'com.fxn769:pix:1.2.5'




    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'

}

错误日志:

  

Android资源链接失败输出:D:\ Android   Projects \ Ghar3 \ app \ src \ main \ res \ layout \ main_layout.xml:23:错误:   找不到属性fabAttached(aka com.recreation.ghar:fabAttached)。   错误:链接文件资源失败。

     

命令:C:\ Users \ Abdul   Qadir.gradle \ caches \ transforms-1 \ files-1.1 \ aapt2-3.2.1-4818971-windows.jar \ 93d85fd8448aa5b91b30eb47e2faac6a \ aapt2-3.2.1-4818971-windows \ aapt2.exe   链接-I \           D:\ sdk \ Android \ sdk \ platforms \ android-28 \ android.jar \            - 表现\           D:\ Android Projects \ Ghar3 \ app \ build \ intermediates \ merged_manifests \ debug \ processDebugManifest \ merged \ AndroidManifest.xml \           -o \           D:\ Android Projects \ Ghar3 \ app \ build \ intermediates \ processed_res \ debug \ processDebugResources \ out \ resources-debug.ap_ \           -R \           @D:\ Android Projects \ Ghar3 \ app \ build \ intermediates \ incremental \ processDebugResources \ resources-list-for-resources-debug.ap_.txt \           --auto-add-overlay \           --java \           D:\ Android Projects \ Ghar3 \ app \ build \ Generated \ not_namespaced_r_class_sources \ debug \ processDebugResources \ r \           --custom-package \           com.recreation.ghar \           -0 \           apk \           --output-text-symbols \           D:\ Android Projects \ Ghar3 \ app \ build \ intermediates \ symbols \ debug \ R.txt \           --no-version-vectors守护程序:AAPT2 aapt2-3.2.1-4818971-windows守护程序#0

1 个答案:

答案 0 :(得分:13)

该属性似乎已在androidx中删除。要附加操作栏,只需将属性app:layout_anchor添加到您的晶圆厂。

<com.google.android.material.floatingactionbutton.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        app:fabSize="normal"
        android:src="@drawable/ic_add_white_24dp"
        app:layout_anchor="@id/bottom_app_bar"/>