SurfaceView 顶部的按钮,在 Android setZOrderOnTop 设置为 true
问题说明
我在一个应用中有两个表面视图,一个表面视图需要与另一个表面视图重叠.例如,假设有两个表面视图 SurfaceView A 和 SurfaceView B.B 需要在 A 之上,这是通过在 B 上设置 setZOrderOnTop(true) 来实现的.
I have two surfaceviews in an app and one surfaceview needs to overlap the other surfaceview. For example, say there are two surfaceviews SurfaceView A and SurfaceView B. B needs to be on top of A which is accomplished by setting setZOrderOnTop(true) on B.
现在,我想在 B 的顶部显示一些文本或按钮,但因为它的 Z 顺序设置为 true,所以添加的文本或按钮不会显示在顶部,而是位于其下方.如果未设置 setZOrderOnTop 属性,则文本视图和按钮确实显示在顶部,但 B 不会与 A 重叠.
Now, I want to display some text or buttons on top of B but because it has Z order set as true the text or buttons added doesn't show on top but come underneath it. If the setZOrderOnTop property is not set then the text views and buttons does show up on top but then B doesn't overlap A.
我已经尝试将 SurfaceView B 和 textview 或按钮放在 FrameLayout 中,但它仍然出现在 B 下.有没有办法可以将 z order 设置为 true 并且仍然可以将文本或按钮放在上面?
I have tried placing SurfaceView B and the textview or buttons in FrameLayout but still it appears under B. Is there a way that z order can be set to true and still text or buttons can come on top of it?
正确答案
我能够通过使用 setZOrderMediaOverlay(true)
而不是 setZOrderOnTop
来解决这个问题.
I was able to resolve the issue by using setZOrderMediaOverlay(true)
instead of setZOrderOnTop
.
方法 setZOrderOnTop
如果设置为 true 将始终位于窗口顶部.因此,为了在表面视图上叠加视图,应该使用 setZOrderMediaOverlay
.
The method setZOrderOnTop
if set to true will always be on top of the window. So, in order to have overlay view over surface view setZOrderMediaOverlay
should be used.
有关详细信息,请参阅此处的 setZOrderMediaOverlay 文档.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfhaek
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22