Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误无法解析符号TabLayout和';设计_Android_Android Gradle Plugin_Android Support Library_Android Tablayout_Android Design Library - Fatal编程技术网

Android 错误无法解析符号TabLayout和';设计

Android 错误无法解析符号TabLayout和';设计,android,android-gradle-plugin,android-support-library,android-tablayout,android-design-library,Android,Android Gradle Plugin,Android Support Library,Android Tablayout,Android Design Library,请帮助:我在导入android.support.design.widget.TabLayout时出错 它说“无法解析符号‘设计’ 我的身材。格雷德尔: compileSdkVersion 26 buildToolsVersion "26.0.0" dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.and

请帮助:我在导入android.support.design.widget.TabLayout时出错 它说
“无法解析符号‘设计’

我的身材。格雷德尔:

     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应用程序
文件中:

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

设计包提供API,支持向应用程序添加材质设计组件和模式

设计支持库增加了对各种材质设计组件和模式的支持,以供应用程序开发人员构建,例如
导航抽屉
浮动动作按钮(FAB)
snackbar
表格布局

或AndroidX依赖项:

implementation "com.google.android.material:material:1.0.0"
com.android.support:design:26.0.2

更新:

使用Androidx

旧的(支持库):

您可以签入,如果要使用,则必须添加此依赖项:

implementation "com.google.android.material:material:1.0.0"
com.android.support:design:26.0.2
dependencies
块中添加
build.gradle

compile 'com.android.support:design:26.0.2'

迁移到androidx时发生这种情况。您必须将其添加到gradle文件中:

implementation 'com.google.android.material:material:1.1.0-alpha09'
此外,表格布局的位置已更改。从

android.support.design.widget.TabLayout

这是androidx的最新版本。 这是新的。

取代了这个:

android.support.design.widget.TabLayout
为此:

import com.google.android.material.tabs.TabLayout;
为我工作!;-)


您需要添加到build_gradle(应用程序):


导入TabLayout没问题,但java仍然无法解析字母“R”,我将项目与Gradle同步,但它不起作用。你知道吗?它显示错误:(46)在包“android”中未找到属性“layout_”的资源标识符我发现了错误,我只是在布局文件中键入了一个错误,所以它生成error@NadeemBhat很高兴帮助你
implementation 'com.google.android.material:material:1.0.0'