小编And*_*lva的帖子

如何使用 Kotlin 声明 Pair 数组

我想做这样的事情:(代码在java中)

Pair[] pairs = new Pair[1];
Run Code Online (Sandbox Code Playgroud)

我想将此代码转换为 kotlin,问题是我不知道如何初始化此数组。这是我的代码:

val prof_intent = Intent(this, NewObjectiveActivity::class.java)
    val pairs = arrayOf(1)
    pairs[0] = Pair<View, String>(fabNewObjective, "activity_trans")

    val options = ActivityOptions.makeSceneTransitionAnimation(this, pairs)
    startActivity(prof_intent, options.toBundle())
Run Code Online (Sandbox Code Playgroud)

android kotlin

5
推荐指数
1
解决办法
4320
查看次数

标签 统计

android ×1

kotlin ×1