有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓 安卓x中定义的java add()。碎片应用程序。零碎交易

无法调用某些FragmentTransaction方法。 例如,我想将BlankFragment添加到FragmentContainerView中,从而导致以下错误

  supportFragmentManager.commit {
       setReorderingAllowed(true)
       add<BlankFragment>(mainBinding.fragmentContainer)
  }
    

enter image description here

这是我的身材。格拉德尔

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation '安卓x.appcompat:appcompat:1.3.1'
implementation '安卓x.core:core-ktx:1.6.0'
implementation '安卓x.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
安卓TestImplementation '安卓x.test.ext:junit:1.1.3'
安卓TestImplementation '安卓x.test.espresso:espresso-core:3.4.0'


implementation 'com.google.安卓.material:material:1.4.0'
implementation '安卓x.legacy:legacy-support-v4:1.0.0'
implementation '安卓x.cardview:cardview:1.0.0'

// Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

// Fragment
def fragment_version = "1.3.6"
implementation "安卓x.fragment:fragment-ktx:$fragment_version"

}

提前谢谢


共 (0) 个答案