gpt4 book ai didi

Android Libs 模糊不工作

转载 作者:太空狗 更新时间:2023-10-29 13:14:54 26 4
gpt4 key购买 nike

我使用 https://github.com/wasabeef/Blurry图书馆。

Onclick 中,以下代码有效。

private boolean blurred = false;

if (blurred) {
Blurry.delete((ViewGroup) findViewById(R.id.content));
} else {
long startMs = System.currentTimeMillis();
Blurry.with(MainActivity.this)
.radius(25)
.sampling(2)
.async()
.animate(500)
.onto((ViewGroup) findViewById(R.id.content));
}
blurred = !blurred;

但是当我在 OnCreate 中添加以下代码时,它不起作用。

Blurry.with(MainActivity.this)
.radius(25)
.sampling(2)
.async()
.animate(500)
.onto((ViewGroup) findViewById(R.id.content));

最佳答案

您的图书馆使用 view size

  factor.width = target.getMeasuredWidth();
factor.height = target.getMeasuredHeight();

当你调用它时。在 onCreate 中,您的 View 尚未创建。例如,您应该将其移动到 onWindowFocusChanged(boolean hasFocus) 或使用来自 this linkfor3st 答案的任何建议

关于Android Libs 模糊不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36028406/

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