为什么我不能覆盖 onAttachFragment?
Why can't I override onAttachFragment?
我有一个从 android.support.v4.app.Fragment 延伸而来的 class。文档 android.support.v4.app.Fragment 显示有一个名为 onAttachFragment(Fragment childFragment)
的方法,但我无法在 Android Studio 中覆盖它。就像它不存在一样。这是有原因的,还是文档中有错误? android.app.Fragment
非支持版本说它已添加到 API 级别 24。不过应该没关系吧?由于我使用的是具有相同 class.
的支持版本
编辑:
这是我在 build.gradle
中的依赖项
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':core-3.2.1')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:7.8+'
compile 'com.microsoft.azure.android:azure-storage-android:0.7.0@aar'
}
您正在使用 23.4.0
版本的支持库。只有 24.X
(即 24.1.1
)版本的支持库将包含在 API 24.
中添加的等效 API
您需要升级您的支持库版本才能使用新的 APIs。
我有一个从 android.support.v4.app.Fragment 延伸而来的 class。文档 android.support.v4.app.Fragment 显示有一个名为 onAttachFragment(Fragment childFragment)
的方法,但我无法在 Android Studio 中覆盖它。就像它不存在一样。这是有原因的,还是文档中有错误? android.app.Fragment
非支持版本说它已添加到 API 级别 24。不过应该没关系吧?由于我使用的是具有相同 class.
编辑: 这是我在 build.gradle
中的依赖项dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':core-3.2.1')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:7.8+'
compile 'com.microsoft.azure.android:azure-storage-android:0.7.0@aar'
}
您正在使用 23.4.0
版本的支持库。只有 24.X
(即 24.1.1
)版本的支持库将包含在 API 24.
您需要升级您的支持库版本才能使用新的 APIs。