简体   繁体   中英

Can't instantiate FloatingActionButton class

I'm following Udacity Google's android basic course data storage. I am not able to instantiate FloatingActionButton class.

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.myfab)

It says can't resolve symbol 'FloatingActionButton.' If someone could help me to create FloatingActionButton, I would really appreciate it.

did you add the support:design in build.gradle: module app to dependencies.

compile 'com.android.support:design:27.1.1'

if using gradle plugin 3.0+

api 'com.android.support:design:27.1.1'

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