问题描述
在我的homeactivity.xml它说:
以下类不能被实例化:
- android.support.design.widget.CoordinatorLayout(公开课,显示异常,清除缓存)
- android.support.design.widget.AppBarLayout(公开课,显示异常,清除缓存)
- android.support.design.widget.FloatingActionButton(公开课,显示异常,清除缓存)
On my homeactivity.xml it says:The following classes could not be instantiated:- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)- android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache)- android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
下面是我的code
Here is my code
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#ff4747"
app:popupTheme="@style/PopupOverlay" />
<include layout="@layout/content_home" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email"
android:background="#001f9c" />
</android.support.design.widget.AppBarLayout>
我不知道为什么会这样。是否有人可以帮助?
I don't know why this happened. Can someone please help?
推荐答案
作为注释,你必须包括依赖
的设计是这样,这将是下添加在依赖
的的build.gradle
应用模块块>
as commented you have to include the dependencies
for design which is like this, this will be added under the dependencies
block of the app
module of the build.gradle
compile 'com.android.support:design:23.1.1'
应该是这样..
it should be something like this ..
如果在设计
依赖
不包含在的build.gradle
并尝试在你的问题使用提到类
您将无法呈现的类
和您在布局得到错误会是这样的。
if the design
dependencies
is not included in the build.gradle
and you try to use mentioned classes
in your question you will not be able to render those classes
and the error you get in layout would be something like this
这篇关于以下类不能被实例化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!