android – 错误无法解析符号TabLayout和’设计

请帮忙:导入 android.support.design.widget.TabLayout时出错
它说“无法解决符号’设计’

我的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 Support Library

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

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依赖:

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

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...