Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 浮动操作按钮没有';行不通_Android - Fatal编程技术网

Android 浮动操作按钮没有';行不通

Android 浮动操作按钮没有';行不通,android,Android,我已将浮动操作按钮添加到我的应用程序中,应用程序因错误而崩溃: Error inflating class android.support.design.widget.FloatingActionButton 按钮在安卓7上运行良好(使用Nexus5Emulator、API24和API25进行测试),但在API23或更低版本上不起作用。从文档中我了解到,FAB应该可以很好地使用这个版本的Android。如何修复此错误?以下是我的工厂代码: <android.support.design.

我已将浮动操作按钮添加到我的应用程序中,应用程序因错误而崩溃:

Error inflating class android.support.design.widget.FloatingActionButton
按钮在安卓7上运行良好(使用Nexus5Emulator、API24和API25进行测试),但在API23或更低版本上不起作用。从文档中我了解到,FAB应该可以很好地使用这个版本的Android。如何修复此错误?以下是我的工厂代码:

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_add_black_48dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:layout_marginRight="16dp"
    android:layout_marginBottom="16dp"
    android:id="@+id/float_btn"
    android:backgroundTint="@color/category_family"
    app:fabSize="normal" />

您使用了错误的属性

更改如下:

android:backgroundTint=“@color/category\u family”

app:backgroundTint=“@color/category\u family”

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '25.0.3'

defaultConfig {
    applicationId "com.example.android.miwok"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.immutables:gson:2.5.3'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}



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