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

本文标题为:错误无法解析符号 TabLayout 和“设计"

基础教程推荐