简体   繁体   中英

Floating Action Button Menu Issue

I found this FloatingActionButton from https://github.com/futuresimple/android-floating-action-button and wanted to add this for my android project for android class. I read and followed its instruction. Of course, I added this dependency to my build.gradle:

I tried to change the API 23 to 22 and I still got same error message. Here is my build.gradle at below:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
       applicationId "com.example.paul.hobbylist"
       minSdkVersion 15
       targetSdkVersion 23
       versionCode 1
       versionName "1.0"
   }
   buildTypes {
       release { 
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'),    'proguard-rules.pro'
       }
   }
}

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   compile 'com.android.support:appcompat-v7:23.1.0'
   compile 'com.android.support:design:23.1.0'
   compile 'com.android.support:support-v4:23.1.0'

   compile 'com.getbase:floatingactionbutton:1.10.1'
}

I tested by creating new project with simple blank layout. Guess what? It worked. I'm not sure why I get error message from my project. Thanks for you time. Please patient with me because I'm not good in English.

EDIT: Add fab_testing.xml

<?xml version="1.0" encoding="utf-8"?>
   <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

      <com.getbase.floatingactionbutton.FloatingActionsMenu
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"/>
   </FrameLayout>

The error message came up in this layout and it said:

Error Messages: "Rending Problems The following classes could not be instantiated: -com.getbase.floatingactionbutton.FloatingActionsMenu(Open Class, Show Exception, Clear Cache)

Tip: Use View.isInEditMode() in your custom view to skip code or show sample data when shown in the IDE"

I used Navigation Drawer Activity for this project. Do you think this conflict with different floating action button?

Problem Solved: I clicked "Clear Cache" and it cleared the error message automatically for me.

尝试重新启动Android Studio转到“文件”->“使缓存无效并重新启动”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM