在的Andr​​oid 2.3(姜饼)删除标题栏会导致问题SurfaceView姜饼、标题栏、问题、oid

2023-09-03 20:41:04 作者:寒香傲雪

任何人都遇到了与他们的姜饼的应用程序有问题? - 如果你使用

Anyone experiencing a problem with their app in Gingerbread? -- if you use

requestWindowFeature(Window.FEATURE_NO_TITLE);

和您切换到另一个窗口,你回来的时候它改变了surfaceview的尺寸。

And you switch to another window, when you come back it changes the dimensions of the surfaceview.

现在,我已经把标题栏重新来解决这个问题。

For now, I've put the titlebar back in to work around this issue.

感谢您的帮助 马克

推荐答案

是的,我们也已经更新到Android 2.3.4之后,经历了这一点。要修复它在我们的应用程序,我们消除了requestWindowFeature(Window.FEATURE_NO_TITLE);在我们的应用程序,然后利用一个styles.xml,保存在该项目的价值与以下文件夹:

Yes, we too have experienced this after updating to Android 2.3.4. To fix it in our apps we eliminated the requestWindowFeature(Window.FEATURE_NO_TITLE); in our apps and then utilized a styles.xml, saved in the project's values folder with the following:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">"
    <item name="android:windowBackground">@color/background</item>
</style>

下面一个colors.xml将用来设置@颜色/背景,这也保存在该项目的价值文件夹中有以下内容:

Here a colors.xml will be utilized to set the @color/background, which is also saved in the project's value folder with the following:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <color name ="background">#000000</color>
</resources>

那么在我们使用的清单文件:

Then in the manifest file we utilized:

<application android:label="@string/app_name"
    android:icon="@drawable/icon"
    android:theme="@style/Theme.Transparent"
>

的主题应用到应用的全过程。也许其他人将有更好的建议,也可能是原因,为什么这发生在姜饼在升级Froyo的requestWindowFeature(Window.FEATURE_NO_TITLE);与SurfaceViews运作良好。

to apply the theme to the application as a whole. Perhaps others will have better suggestions and also maybe a reason for why this occurs in Gingerbread as in Froyo the requestWindowFeature(Window.FEATURE_NO_TITLE); worked well with SurfaceViews.