在我的应用程序中,我使用com.android.support:design:25.0.0
来获取FloatingActionButton
,但是当我为它设置Icon时
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>
Gradle Dependecies:
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'
}
修改
答案 0 :(得分:0)
尝试添加src
而不是图标。请遵守代码。
android:src="@android:drawable/ic_done"