元素共享的过渡有效,但是共享的多个元素不起作用[Android]

时间:2020-01-12 19:26:21

标签: android animation kotlin transition

https://developer.android.com/training/transitions/start-activity.html开始,我从按钮切换活动时将在textView和View之间创建过渡。

按钮的代码:

 btnStart.setOnClickListener {
            val intent = Intent(this, FactsActivity::class.java)
            val options = ActivityOptions.makeSceneTransitionAnimation(this,
                UtilPair.create(shapeTop, "transitionShape"),
                UtilPair.create(israelFacts, "textTransition"))
            startActivity(intent, options.toBundle())
        }

当我删除第二个UtilPar.create时,一切正常,但是当两者都存在时,makeSceneTransitionAnimation会出错。我该如何解决?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,就我而言,似乎所有进口商品都排好了序。这是与导入配合使用的代码。

checkWin() {
        if (cards[Object.keys(cards)[12]].number === 0) {
            alert("GAME OVER");
        }
    }

    drawCard() {
        let cardNumber;
        do {
            cardNumber = Math.floor(Math.random() * (Object.keys(cards).length));
        }
        while (cards[Object.keys(cards)[cardNumber]].number === 0);
        var card = cards[Object.keys(cards)[cardNumber]];
        card.number = card.number - 1;
        console.log()
        this.setState({
            card: card.images[card.number + 1],
            total: this.state.total -1,
            description: card.description
        }, this.checkWin());
    }