很多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 黑块问题相关推荐

  1. Android学习笔记之别踩白块(简易版:狂踩黑块)

    项目地址:https://github.com/Changing001/Game_not_step_white 花了一天多时间,搞了这个小游戏,自我感觉不错,特意放上来,不过还是有点问题, 没有设置踩 ...

  2. Android截屏SurfaceView黑屏问题解决办法

    Android截屏SurfaceView黑屏问题解决办法 参考文章: (1)Android截屏SurfaceView黑屏问题解决办法 (2)https://www.cnblogs.com/kongyf ...

  3. camera android 黑屏,Android Camera.startPreview()启动未报错,但SurfaceView无画面输出

    问题如标题所示,不知道问题出在那里,能正常出数据,但是画面就是没有,请各位大神指点迷津 代码如下 package com.jiechu.wnd.sl; import android.content.C ...

  4. android 屏幕底部有黑边,问题来了,手机屏幕边缘的黑边到底是什么?

    现在的手机屏幕尺寸是变得越来越大了,而且手机屏幕用上的技术也越来越优秀.不过细心的用户发现,在我们的手机屏幕与边框之间,总是存在一条"黑边",而且白色机身的手机上是尤为明显,看着实 ...

  5. android 工具 Draw 9-patch 和去黑边

    Copy from: http://blog.csdn.net/yan8024/article/details/6222582 个人总结: 1.如果使用打开9Patch时,发现下图右边的三种视图看不到 ...

  6. android华为虚拟截屏黑屏,Android截屏表面视图显示黑屏

    Android截屏表面视图显示黑屏 我试图通过代码拍摄我的游戏的截图,并通过一个意图来分享它.我能做这些事情,但是截图总是看起来是黑色的.下面是与分享截图相关的代码:View view = MainA ...

  7. Android项目启动时短暂的黑屏白屏处理

    刚从csdn转战51,这是在51写的第一篇博客 那么我们来谈谈这样一个问题.当你的项目需要用的欢迎界面有时候会出现短暂的黑屏或白屏,这样用户体验就不好了,所以今天教教大家如何处理这种问题. 其实,黑屏 ...

  8. 解决unity 打包在Android 8.0上启动出现黑屏问题(Android权限弹窗问题)

    解决unity 打包在Android 8.0上启动出现黑屏问题 本文链接:https://blog.csdn.net/baidu_34248947/article/details/89377983 我 ...

  9. Android 解决程序启动时的黑屏问题

    关于黑屏默认的情况下,程序启动时,会有一个黑屏的时期,原因是,首个activity会加载一些数据,比如初始化列表数据.向服务器发送请求获取数据等等. 去除方法: 1.在style里面添加一个style ...

  10. unity5.6.5适配Android P刘海屏,两侧去黑边

    unity5.6.5适配Android P刘海屏,两侧去黑边 问题: 如果不适配安卓P的话,有刘海屏的手机,刘海两侧会有黑边, 两侧默认是不渲染的,所以要渲染出来就得先适配一下 解决方法: 我是用ec ...

最新文章

  1. nagios+mysql+ndo2安装总结
  2. 计算机视觉领域不同的方向:目标识别、目标检测、语义分割等
  3. VMware 使用
  4. Spring基础学习笔记-Bean的基础知识
  5. 枚举项的数量限制在64个以内
  6. 《疯狂Java讲义》(十五)---- 内部类
  7. 多库多事务降低数据不一致概率
  8. ZJOI2019 线段树
  9. 工程控制论 理论概况
  10. android 1024 github,1024 怎么能少了这款高颜值、敲实用的 GitHub 第三方客户端呢?...
  11. 浅析信息安全风险评估(CCRC)的重要性
  12. python函数调用:带()和不带()的区别
  13. 云栖大会马总演讲:《未来属于善于拥抱未来的人》
  14. 力天创见客流、热区系统WEB管理
  15. 2023年产品经理需要考的证书,NPDP含金量真高
  16. 想拥有一个自由时间的职业_如何以自由职业者的身份管理时间
  17. adjacent angle_帝学教育:新SAT数学词汇中英文对照(几何篇)
  18. struts新人培训1
  19. html的url中写什么意思,url的含义是什么?
  20. c语言大小写字母相互转化,字母大小写互相转换 ASCII码转化符号问题

热门文章

  1. vim编辑二进制文件
  2. Python入门篇-functools
  3. Linux主机WordPress伪静态设置方法
  4. Spring Cloud Zuul
  5. 初步理解TCP/IP网络
  6. BestCoder Round #80 1002
  7. 一句话告诉你们什么是大数据
  8. 几经沉浮,自乱前程——硬盘巨头启示录之迈拓篇
  9. Mybatis分库分表扩展插件
  10. linux c 文件描述符 得到 文件名