请帮助:导入时我得到错误android.support.design.widget.TabLayout
它说"can not resolve symbol 'design'
我的build.gradle:
compileSdkVersion 26
buildToolsVersion "26.0.0"
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:26'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26'
testCompile 'junit:junit:4.12'
}
你忘了添加设计支持库。只需在gradle app
文件中添加此依赖项:
implementation 'com.android.support:design:26.0.+'
Design包提供API以支持向您的应用添加材料设计组件和模式。
设计支持库增加了对应用程序开发人员构建的各种材料设计组件和模式的支持,例如
navigation drawers
,floating action buttons (FAB)
,snackbars
和TabLayout
。
或者AndroidX依赖:
implementation "com.google.android.material:material:1.0.0"