Android:无法实例化FloatingActionButton [英] Android: FloatingActionButton could not be instantiated

查看:64
本文介绍了Android:无法实例化FloatingActionButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中使用浮动操作按钮(FAB). 但是,当我声明相同的消息时,会出现错误:

I am trying to use Floating Action Button(FAB) in my application. However, when I am declaring the same I get the error:

android.support.design.widget.FloatingActionButton could not be instantiated.

我已将以下命令添加到我的gradle文件中:

I have added following commands to my gradle file:

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'

我还尝试将以下内容添加到样式父中:

I have also tried with adding following to my style parent:

parent="@style/Theme.AppCompat"

还尝试了我的Activity类extend ActivityAppCompatActivity.

Also tried having my Activity class extend Activity as well as AppCompatActivity.

我错过了什么吗?请帮助

Am I missing something? Pls. help

推荐答案

Android构建系统使用Android Plugin for Gradle支持 使用Gradle构建工具包构建Android应用程序.这 插件独立于Android Studio运行,因此插件和Gradle 构建系统可以独立于Android Studio进行更新.

Android build system uses the Android Plugin for Gradle to support building Android applications with the Gradle build toolkit. The plugin runs independent of Android Studio so the plugin and the Gradle build system can be updated independently of Android Studio.

对于FloatingActionButton要求

请更新您的classpath

  dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

    }

这篇关于Android:无法实例化FloatingActionButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆