2015-05-14 122 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。然後,再次打開。這個對我有用。