gpt4 book ai didi

Android makeClipRevealAnimation

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:22:13 25 4
gpt4 key购买 nike

我正在使用 actvityOptionComapatma​​keclipRevealAnimation 来打开新 Activity ,但我想要圆形来显示效果,但我正在进入正方形。

是否可以实现循环效果?

button.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,SecActivity.class);
ActivityOptionsCompat activityOptionsCompat=
ActivityOptionsCompat.makeClipRevealAnimation(button,
button.getMeasuredWidth(),button.getMeasuredWidth(),
relativeLayout.getWidth(),relativeLayout.getHeight());
startActivity(intent,activityOptionsCompat.toBundle());
}
});
}

最佳答案

我正在使用它并且它工作正常。它是用 Kotlin 编写的,但用 Java 编写不会有问题。

//Start an activity from a specific point with reveal animation.
fun revealBundle(v: View): Bundle? {
var opts: ActivityOptions? = null
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
val left = 0
val top = 0
val width = v.measuredWidth
val height = v.measuredHeight
opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height)
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP -> opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.measuredWidth, v.measuredHeight)
}
return opts?.toBundle()
}

关于Android makeClipRevealAnimation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43695646/

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