Removing Title Bar in Android 2.3 (Gingerbread) causes problem with SurfaceView
Anyone experiencing a problem with their app in Gingerbread? -- if you use
requestWindowFeature(Window.FEATURE_NO_TITLE);
And you switch to another window, when you come back it changes the dimensions of the surfaceview.
For now, I've put the tit开发者_如何学Golebar back in to work around this issue.
Thanks for any help Mark
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>
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"
>
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.
精彩评论