如何放置UI部件上的Andr​​oid的多个z有序的表面顶视图顶视图、多个、部件、表面

由网友(冰红茶不冰)分享简介:我有2 SurfaceViews 1 按钮,他们需要被安排在类似附截图的方式。我能得到 SurfaceView乙将在 SurfaceView A 的顶部通过调用 surfaceViewB。 setZOrderOnTop(真); I have 2 SurfaceViews and 1 button and the...

我有2 SurfaceViews 1 按钮,他们需要被安排在类似附截图的方式。我能得到 SurfaceView乙将在 SurfaceView A 的顶部通过调用 surfaceViewB。 setZOrderOnTop(真);

I have 2 SurfaceViews and 1 button and they need to be arranged in a way similar to the attached screenshot. I was able to get SurfaceView B to be on top of SurfaceView A by calling surfaceViewB.setZOrderOnTop(true);

问题是,一旦我这样做, SurfaceView乙放在实际窗口上方,我不再能够得到按钮上的顶部它(例如调用 button.bringToFront()也没用这里)。

The problem is that, once I do that, SurfaceView B is placed above the actual Window and I'm no longer able to get the Button to be on top of it (eg. calling button.bringToFront() is useless here).

任何想法,这个布局怎么可能实现呢?

Any idea how this layout could be accomplished?

推荐答案

您可以使用 setZOrderMediaOverlay(布尔)放置SurfaceView B历时SurfaceView A,但仍是窗口的后面。从技术文档:链接:

You can use setZOrderMediaOverlay(boolean) to place SurfaceView B over SurfaceView A, but still behind the window. From documentation: Link:

公共无效setZOrderMediaOverlay(布尔isMediaOverlay)

public void setZOrderMediaOverlay (boolean isMediaOverlay)

控制是否表面视图的表面放置的在另一个之上  在窗口规则的表面视图(但仍是窗口的后面  本身)。这通常用于放置叠加上的一个顶  底层介质表面视图。

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.

调用此覆盖任何previous调用setZOrderOnTop(布尔)。

Calling this overrides any previous call to setZOrderOnTop(boolean).

因此​​,下面应该为你工作:

So, the following should work for you:

surfaceViewB.setZOrderMediaOverlay(true);
阅读全文

相关推荐

最新文章