android屏幕底部黑块,Android surfaceView 黑块问题
很多Android机上会出现surfaceView结束播放后,出现概率的黑块,典型的解决方案
setZOrderMediaOverlay(false);
setZorderTop(false);
/**
* Control whether the surface view's surface is placed on top of another
* regular surface view in the window (but still behind the window itself).
* This is typically used to place overlays on top of an underlying media
* surface view.
*
*
Note that this must be set before the surface view's containing
* window is attached to the window manager.
*
*
Calling this overrides any previous call to {@link #setZOrderOnTop}.
*/
public void setZOrderMediaOverlay(boolean isMediaOverlay) {
mWindowType = isMediaOverlay
? WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY
: WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
}
/**
* Control whether the surface view's surface is placed on top of its
* window. Normally it is placed behind the window, to allow it to
* (for the most part) appear to composite with the views in the
* hierarchy. By setting this, you cause it to be placed above the
* window. This means that none of the contents of the window this
* SurfaceView is in will be visible on top of its surface.
*
*
Note that this must be set before the surface view's containing
* window is attached to the window manager.
*
*
Calling this overrides any previous call to {@link #setZOrderMediaOverlay}.
*/
public void setZOrderOnTop(boolean onTop) {
if (onTop) {
mWindowType = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
// ensures the surface is placed below the IME
mLayout.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
} else {
mWindowType = WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
mLayout.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
}
实际上根本没有用!
那么下面代码可以吗?
\\设置透明
setAlpha(0);
\\设置不可见
setVisibility(GONE);
实际也没有用!
最终得这样才行
release();
找到对应的“drawer”,然后释放掉渲染器才行!!!
参考webrtc代码
public void release() {
this.logD("Releasing.");
final CountDownLatch eglCleanupBarrier = new CountDownLatch(1);
Object var2 = this.handlerLock;
synchronized(this.handlerLock) {
if(this.renderThreadHandler == null) {
this.logD("Already released");
return;
}
this.renderThreadHandler.removeCallbacks(this.logStatisticsRunnable);
this.renderThreadHandler.postAtFrontOfQueue(new Runnable() {
public void run() {
if(EglRenderer.this.drawer != null) {
EglRenderer.this.drawer.release();
EglRenderer.this.drawer = null;
}
if(EglRenderer.this.yuvTextures != null) {
GLES20.glDeleteTextures(3, EglRenderer.this.yuvTextures, 0);
EglRenderer.this.yuvTextures = null;
}
if(EglRenderer.this.bitmapTextureFramebuffer != null) {
EglRenderer.this.bitmapTextureFramebuffer.release();
EglRenderer.this.bitmapTextureFramebuffer = null;
}
if(EglRenderer.this.eglBase != null) {
EglRenderer.this.logD("eglBase detach and release.");
EglRenderer.this.eglBase.detachCurrent();
EglRenderer.this.eglBase.release();
EglRenderer.this.eglBase = null;
}
eglCleanupBarrier.countDown();
}
});
final Looper renderLooper = this.renderThreadHandler.getLooper();
this.renderThreadHandler.post(new Runnable() {
public void run() {
EglRenderer.this.logD("Quitting render thread.");
renderLooper.quit();
}
});
this.renderThreadHandler = null;
}
ThreadUtils.awaitUninterruptibly(eglCleanupBarrier);
var2 = this.frameLock;
synchronized(this.frameLock) {
if(this.pendingFrame != null) {
VideoRenderer.renderFrameDone(this.pendingFrame);
this.pendingFrame = null;
}
}
this.logD("Releasing done.");
}
android屏幕底部黑块,Android surfaceView 黑块问题相关推荐
- Android学习笔记之别踩白块(简易版:狂踩黑块)
项目地址:https://github.com/Changing001/Game_not_step_white 花了一天多时间,搞了这个小游戏,自我感觉不错,特意放上来,不过还是有点问题, 没有设置踩 ...
- Android截屏SurfaceView黑屏问题解决办法
Android截屏SurfaceView黑屏问题解决办法 参考文章: (1)Android截屏SurfaceView黑屏问题解决办法 (2)https://www.cnblogs.com/kongyf ...
- camera android 黑屏,Android Camera.startPreview()启动未报错,但SurfaceView无画面输出
问题如标题所示,不知道问题出在那里,能正常出数据,但是画面就是没有,请各位大神指点迷津 代码如下 package com.jiechu.wnd.sl; import android.content.C ...
- android 屏幕底部有黑边,问题来了,手机屏幕边缘的黑边到底是什么?
现在的手机屏幕尺寸是变得越来越大了,而且手机屏幕用上的技术也越来越优秀.不过细心的用户发现,在我们的手机屏幕与边框之间,总是存在一条"黑边",而且白色机身的手机上是尤为明显,看着实 ...
- android 工具 Draw 9-patch 和去黑边
Copy from: http://blog.csdn.net/yan8024/article/details/6222582 个人总结: 1.如果使用打开9Patch时,发现下图右边的三种视图看不到 ...
- android华为虚拟截屏黑屏,Android截屏表面视图显示黑屏
Android截屏表面视图显示黑屏 我试图通过代码拍摄我的游戏的截图,并通过一个意图来分享它.我能做这些事情,但是截图总是看起来是黑色的.下面是与分享截图相关的代码:View view = MainA ...
- Android项目启动时短暂的黑屏白屏处理
刚从csdn转战51,这是在51写的第一篇博客 那么我们来谈谈这样一个问题.当你的项目需要用的欢迎界面有时候会出现短暂的黑屏或白屏,这样用户体验就不好了,所以今天教教大家如何处理这种问题. 其实,黑屏 ...
- 解决unity 打包在Android 8.0上启动出现黑屏问题(Android权限弹窗问题)
解决unity 打包在Android 8.0上启动出现黑屏问题 本文链接:https://blog.csdn.net/baidu_34248947/article/details/89377983 我 ...
- Android 解决程序启动时的黑屏问题
关于黑屏默认的情况下,程序启动时,会有一个黑屏的时期,原因是,首个activity会加载一些数据,比如初始化列表数据.向服务器发送请求获取数据等等. 去除方法: 1.在style里面添加一个style ...
- unity5.6.5适配Android P刘海屏,两侧去黑边
unity5.6.5适配Android P刘海屏,两侧去黑边 问题: 如果不适配安卓P的话,有刘海屏的手机,刘海两侧会有黑边, 两侧默认是不渲染的,所以要渲染出来就得先适配一下 解决方法: 我是用ec ...
最新文章
- nagios+mysql+ndo2安装总结
- 计算机视觉领域不同的方向:目标识别、目标检测、语义分割等
- VMware 使用
- Spring基础学习笔记-Bean的基础知识
- 枚举项的数量限制在64个以内
- 《疯狂Java讲义》(十五)---- 内部类
- 多库多事务降低数据不一致概率
- ZJOI2019 线段树
- 工程控制论 理论概况
- android 1024 github,1024 怎么能少了这款高颜值、敲实用的 GitHub 第三方客户端呢?...
- 浅析信息安全风险评估(CCRC)的重要性
- python函数调用:带()和不带()的区别
- 云栖大会马总演讲:《未来属于善于拥抱未来的人》
- 力天创见客流、热区系统WEB管理
- 2023年产品经理需要考的证书,NPDP含金量真高
- 想拥有一个自由时间的职业_如何以自由职业者的身份管理时间
- adjacent angle_帝学教育:新SAT数学词汇中英文对照(几何篇)
- struts新人培训1
- html的url中写什么意思,url的含义是什么?
- c语言大小写字母相互转化,字母大小写互相转换 ASCII码转化符号问题