0

所以基本上我有一个应用程序,它可以进行一些开放式 gl 渲染,但也可以进行一些用户输入的活动来设置一些东西。

奇怪的事情,但是如果我进入一个没有以下属性的活动

android:theme="@style/ThemeDialog"

其中 ThemeDialog 基本上是一种将 parent 属性设置为的样式

@android:style/Theme.Holo.Dialog"

表面视图被破坏。一个与另一个到底是如何关联的?我似乎找不到合理的解释。你能帮我么?

4

2 回答 2

1

默认主题使用不透明窗口。这意味着当您打开一个Activity没有在清单中指定的主题时,它会隐藏Activity包含您的SurfaceView. 当 anActivity被隐藏时,系统可以自由地回收表面。当您回到原来的Activity.

于 2013-03-22T21:23:10.020 回答
0

Let's say I have activities A B C D and E.

A B C D - all have the same theme, Theme.Holo.Dialog E - doesn't have any theme specified (so the default, opaque one)

A - this activity holds the surface that I draw on

If I open A, then B (over A), then C (over B), then D (over C), the surface is OK.

If I open A, then B (over A), then C (over B), then E (over C), the following happens: 1. when switching from C to E, the surface is destroyed and 2. when going back from E to C, the surface is restored (surface changed event)

As you can see, A is far behind this sequence of activities. So what does A's surface got to do with the fact that E has no theme? Why is A'surface being destroyed when switching from a themable activity (C) to a non themable one (E)?

于 2013-03-26T15:02:59.477 回答