[英]Why I can't import Snackbar class
I can't import this: android.support.design.widget.Snackbar;
我无法导入:
android.support.design.widget.Snackbar;
The result is: The import android.support.design
cannot be resolved结果是:import
android.support.design
无法解析
You have to import the right library into your build.gradle.您必须将正确的库导入到 build.gradle 中。
If you are using the "normal" android library add this implementation:如果您使用的是“普通”android 库,请添加此实现:
implementation 'com.android.support:design:28.0.0'
and this is the import statement:这是导入语句:
import android.support.design.widget.Snackbar;
If you are using the AndroidX library add this implementation:如果您使用的是 AndroidX 库,请添加以下实现:
implementation 'com.google.android.material:material:1.0.0'
and this is the import statement:这是导入语句:
import com.google.android.material.snackbar.Snackbar;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.