错误无法解析符号 TabLayout 和“设计"

error can not resolve symbol TabLayout and #39;design(错误无法解析符号 TabLayout 和“设计)
本文介绍了错误无法解析符号 TabLayout 和“设计"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

请帮助:导入 android.support.design.widget.TabLayout 时出错它说无法解析符号'design'

Please help: I got error when import android.support.design.widget.TabLayout It say "can not resolve symbol 'design'

我的 build.gradle:

My 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 文件中添加此依赖项:

You forgot to add design support library. Just add this dependencies in your gradle app file:

implementation 'com.android.support:design:26.0.+'

设计支持库

Design 包提供 API 以支持向您的应用添加材料设计组件和模式.

The Design package provides APIs to support adding material design components and patterns to your apps.

Design Support 库增加了对各种材料设计组件和模式的支持,供应用开发者构建,例如 navigation drawersfloating action buttons (FAB)snackbarsTabLayout.

The Design Support library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and TabLayout.

或AndroidX依赖:

Or AndroidX dependency:

implementation "com.google.android.material:material:1.0.0"

这篇关于错误无法解析符号 TabLayout 和“设计"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)