我试图表现出的小吃店错误与方法品牌和符号LENGTH_LONG在小吃吧
Snackbar.make(view.findViewById(android.R.id.content), "Message", Snackbar.LENGTH_LONG).show();
但有两个错误,我不知道为什么?
1.
Cannot resolve method 'make(android.view.View, java.lang.String, ?)'
2.
Cannot resolve symbol 'LENGTH_LONG'
UPDATE
的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 10
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.nispok:snackbar:2.6.1'
}
从你在哪里调用小吃吧? – OBX
@OBX来自非主要活动类别。当我从主要活动呼叫时,也会发生这些错误。 – SAM
'Snackbar.make(this.findViewById(android.R.id.content),“Message”,Snackbar.LENGTH_LONG).show();'你可以试试这个从活动,看看它的解决? – OBX