【问题标题】:Android Studio Designer could not find classAndroid Studio Designer 找不到类
【发布时间】:2015-07-25 19:42:00
【问题描述】:

我面临一个非常奇怪的问题。

我正在使用this library 来添加材料设计元素,例如浮动按钮。

一切正常,但突然间,Android Studio 设计师开始警告我找不到com.gc.materialdesign.view.ButtonFloat

当我改成ButtonFlat时,设计师要求改成ButtonFloat

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

另外,按钮在模拟器中完美显示:

有问题的代码如下:

<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:1.+@aar'
    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:0.9.10@aar'
}

这很烦人。我多次尝试清理和构建项目。你有什么主意吗 ?提前谢谢你。

【问题讨论】:

    标签: android android-studio material-design


    【解决方案1】:

    有时 android studio 无法正确显示自定义布局标签。那时,我需要关闭项目并关闭android studio。然后,再次重新打开。它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-07
      • 1970-01-01
      • 2016-08-29
      • 2016-03-02
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      • 2020-11-09
      相关资源
      最近更新 更多