Android系统用canvas或GLSurfaceView叠加速度极慢

发布于 2024-12-14 10:39:00 字数 732 浏览 3 评论 0原文

我想在 Android 中实现一些非标准的东西。

我已经使用 GLSurfaceView 在所有内容之上创建了透明系统覆盖层 (WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY)(然后我将其更改为画布),并且我正在尝试绘制一些东西在它上面。

问题是,当尝试将我的透明层与其下面的其他内容混合时,Android 变得非常慢。我知道这个操作会很慢,但它非常慢。我在或多或少的功率设备上进行了测试。

一些事实和观察:

  • 我的覆盖视图是全屏的,
  • 即使我不绘制任何内容来覆盖,系统也会变慢。
  • 我的 Acer Iconia 选项卡(10 英寸)的运行速度比我的 Droid X 慢得多(需要混合更多像素?或者新的渲染管道?
  • )我使用带有透明 PNG 的静态 ImageView ,而不是 Android 混合它 没有问题。为什么? Android 会检查每一帧要混合的内容吗?
  • 在平板电脑上启用硬件加速没有效果

我的问题:是否可以以某种方式对其进行优化?我将视图的背景设置为空,但没有效果。

Android 4.0会像3.2一样慢吗?

当它在主屏幕上混合系统覆盖时,速度特别慢。为什么?

请不要告诉我,我写了错误的东西,并将 API 用于指定目的之外的用途,我已经意识到这一点。

I want to implement something non-standard in Android.

I've created transparent system overlay (WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY) on top of everything with GLSurfaceView (then I changed it to canvas) and I'm trying to draw something on it.

The problem is that Android becomes very slow when trying to blend my transparent layer with other things under it. I know that this operation will be slow, but it's very slow. I tested on more or less power devices.

Few facts and observations:

  • My overlay view is fullscreen
  • System becomes slow even if I draw nothing to overlay
  • My Acer Iconia tab (10") runs it much much slower than my Droid X (more pixels to blend? Or new rendering pipeline?)
  • If I use a static ImageView with a transparent PNG than Android blends it
    without problems. Why? Does Android check what to blend every frame?
  • Enabling hardware acceleration on the tablet has no effect

My question: Is it possible to optimize it somehow? I set background of my View to null but it had no effect.

Will Android 4.0 be as slow as 3.2?

It's especially slow when it blends a system overlay over the home screen. Why?

Please do not tell me that I'm writing the wrong things and using API for things other than their designated purposes, I'm already aware of that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文