Comments (9)
public void draw(Canvas canvas) {
if (mIsRendering) {
// Quit here, don't draw views above me
throw STOP_EXCEPTION;
} else if (RENDERING_COUNT > 0) {
// Doesn't support blurview overlap on another blurview
} else {
super.draw(canvas);
}
}
从 二级页面返回一级的时候,会走 这个,然后 throw STOP_EXCEPTION。这是唯一能发现的线索,但 logcat 本身没任何消息。
from realtimeblurview.
经过排查,和 fragment 转场动画有关,关掉转场动画即可。
from realtimeblurview.
目前试了一下,除了渐变的 fade 动画,其他转场动画都会导致返回时不显示内容。
所以,有没有提供 api,使得 blur view 可以手动关闭和恢复毛玻璃呢?
from realtimeblurview.
现在改用 多 Activity 架构了。就是统一地在原来 fragment 的基础上套一层通用的 Activity,来独占 window 资源。
from realtimeblurview.
我使用的时候, 在页面A使用, 跳转页面B, 再回来页面A模糊效果也没了。 后来排查了一下, 是 RealtimeBlurView 里面的 blur 方法有问题, 继承 RealtimeBlurView, 重写 blur 方法, 就解决了, 不知道你的问题是不是和我的一样。
from realtimeblurview.
@nukix 哈哈,倒不是,我是 页面A 的内容全部不显示了。我通过为每个 fragment 套一个 Activity(申请到独立的 window)解决了。
from realtimeblurview.
@nukix 重写 blur 方法, 就解决了,重写的方法是怎么样写的?能贴一下代码吗
from realtimeblurview.
没有找到原因,我这只能简单粗暴的去解决了
@OverRide
public void showBlurView() {
if (blurView == null) {
//blurView.setVisibility(View.VISIBLE);
blurView = new RealtimeBlurView(this,null);
blurView.setBlurRadius(20);
blurView.setOverlayColor(Color.TRANSPARENT);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
mainFrameLayout.addView(blurView,params);
}
}
@Override
public void hideBlurView() {
if (blurView != null) {
//blurView.setVisibility(View.GONE);
mainFrameLayout.removeView(blurView);
blurView = null;
}
}
from realtimeblurview.
我不清楚你遇到什么问题, 我只是重写 blur 用高斯模糊。 因为我 Debug 的时候, 发现回去原本的页面, 这个方法获得的模糊图变成了全0的透明图, 导致模糊失效了。
@Override
protected void blur(Bitmap bitmapToBlur, Bitmap blurredBitmap) {
// super.blur(bitmapToBlur, blurredBitmap);
RenderScript renderScript = RenderScript.create(getContext());
// Allocate memory for Renderscript to work with
final Allocation input = Allocation.createFromBitmap(renderScript, bitmapToBlur);
final Allocation output = Allocation.createTyped(renderScript,input.getType());
// Load up an instance of the specific script that we want to use.
ScriptIntrinsicBlur scriptIntrinsicBlur = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
scriptIntrinsicBlur.setInput(input);
// Set the blur radius
scriptIntrinsicBlur.setRadius(25);
// Start the ScriptIntrinisicBlur
scriptIntrinsicBlur.forEach(output);
// Copy the output to the blurred bitmap
output.copyTo(blurredBitmap);
renderScript.destroy();
}
from realtimeblurview.
Related Issues (20)
- Android 4.1 use AndroidX crash HOT 1
- How can I use it in a ViewHolder correctly? HOT 1
- Video HOT 1
- Canvas: trying to use a recycled bitmap android.graphics.Bitmap@3b51abf HOT 1
- Support for circle shape blur HOT 2
- java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps HOT 5
- Please migrate library to AndroidX package
- The blur view will show part when execute scale animator
- BUG
- A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 4247 (HeapTaskDaemon), pid 4160
- DialogFragment中使用不起作用 HOT 1
- The onStop or onDestroy method delay 10 seconds HOT 1
- Window上面没效果
- 能支持圆角吗 HOT 1
- Jcenter is closed HOT 1
- 应用中有RealtimeBlur使用,切到后台运行回来后偶现闪退问题.
- Usage on Jetpack Compose HOT 2
- android.renderscript.RSInvalidStateException: Calling RS with no Context active HOT 4
- Exception java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtimeblurview.