错误无法解析符号 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 和“设计"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

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

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)