gpt4 book ai didi

java - 如何解决找不到符号方法addOnTabSelectedListener?

转载 作者:行者123 更新时间:2023-12-02 06:22:40 32 4
gpt4 key购买 nike

如何解决在android studio中找不到符号方法addOnTabSelectedListener?我尝试添加依赖项仍然存在错误

下面是我的 buid.gradle 文件

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'

defaultConfig {
applicationId "com.parse.starter"
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation 'com.android.support:appcompat-v7:23.4.0'
implementation 'com.parse.bolts:bolts-tasks:1.3.0'
implementation 'com.parse:parse-android:1.13.0'
implementation 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.1.1'

implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:23.4.0'
}

日志Android资源编译失败

C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2979: error: duplicate value for resource 'attr/layout_scrollFlags' with config ''.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2979: error: resource previously defined here.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3059: error: duplicate value for resource 'attr/behavior_peekHeight' with config ''.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3059: error: resource previously defined here.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3108: error: duplicate value for resource 'attr/layout_collapseMode' with config ''.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3108: error: resource previously defined here.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3230: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''.
C:\Users\JEFF\Desktop\Instagram\ParseStarterProject\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3230: error: resource previously defined here.

最佳答案

尝试一下

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

使用

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

真实用例:

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextColor="@color/gray"
app:tabSelectedTextColor="@color/blue"
app:tabIndicatorColor="@color/blue"
android:background="@color/white"
/>

最好使用 androidX 而不是支持库

关于java - 如何解决找不到符号方法addOnTabSelectedListener?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55820139/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com