2015-05-14 124 views
3

我正面临一个非常奇怪的问题。Android Studio Designer找不到类

我使用this library为了添加材料设计元素,如浮动按钮。

所有运作良好,但suddendly了Android Studio设计开始警告我说,com.gc.materialdesign.view.ButtonFloat找不到:

enter image description here

当我更改为ButtonFlat,设计师提出更改为ButtonFloat,等

奇怪的是,在我的XML中,该类是已知的并且没有错误。

enter image description here

Additionnaly,按钮在仿真器是完全示出了:

enter image description here

有问题的一段代码如下:

<com.gc.materialdesign.views.ButtonFloat 
    android:id="@+id/buttonFloatTakePicture" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentEnd="true" 
    android:layout_marginEnd="20dp" 
    android:layout_marginTop="50dp" 
    materialdesign:animate="true" 
    materialdesign:iconDrawable="@mipmap/ic_photo" 
    android:onClick="takePhoto" /> 

我给的build.gradle此模块:

repositories { 
    jcenter() 
} 

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 22 
    buildToolsVersion '22.0.1' 
    defaultConfig { 
     minSdkVersion 21 
     targetSdkVersion 22 
    } 
} 

dependencies { 
    compile 'com.github.navasmdc:MaterialDesign:[email protected]' 
    compile 'com.nineoldandroids:library:2.4.+' 
    compile 'com.android.support:appcompat-v7:22.1.1' 
    compile 'com.android.support:recyclerview-v7:22.1.1' 
    compile 'com.nineoldandroids:library:2.4.+' 
    compile 'com.soundcloud.android:android-crop:[email protected]' 
} 

这很烦人。我试图清理并多次构建项目。你有什么主意吗 ?先谢谢你。

回答

0

有时android studio不能正确显示自定义布局标记。那时候,我需要关闭项目并关闭android studio。然后,再次打开。这个对我有用。