2016-11-07 37 views
-3

在我的应用我使用com.android.support:design:25.0.0获得FloatingActionButton但是当过我吧无法解析绘制fab_icon的Android

app:fab_icon="@drawable/ic_done" 

设置图标,我得到一个错误

Cannot Resolve symbol @drawable/ic_done

我尝试过其他图标,但没有一个在工作?

XML:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab_cust" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="end|bottom" 
     android:layout_margin="16dp" 
     /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab_nxt" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="end|bottom" 
     android:layout_margin="16dp" 
     app:fab_icon="@drawable/ic_done" 
     /> 

</android.support.design.widget.CoordinatorLayout> 

摇篮依赖条件:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.android.support:support-v4:24.2.1' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.getbase:floatingactionbutton:1.10.1' 
    testCompile 'junit:junit:4.12' 
} 

编辑:

香港专业教育学院还试图与Android替代fab_icon:src,却没有它的工作。 enter image description here

+0

你可以发布你的XML代码 – sasikumar

+0

变化'com.android.support:设计:25.0.0'到'com.android.support:设计:24.2.1'和尝试 –

+0

@sasikumar我已经更新XML的问题。实际上它不能用特定的名字绘制。如果我没有错,它们由设计支持库提供。但无法访问它们。 –

回答

0

尝试添加src而不是图标。遵循代码。

android:src="@android:drawable/ic_done"