lundi 4 mai 2015

Android - Hiding the Status Bar on PreferenceFragment

I currently have a PreferenceActivity class which contains a PreferenceFragment. The PreferenceActivity doesn't show the statusbar, only the actionbar. But when i click an option to open a 'sub-menu', the statusbar appears and 'pushes everything down'.

AndroidManifest.xml:

<activity
    android:name="com.myapp.SettingsActivity"
    android:label="@string/title_settings"
    android:theme="@style/mySettingsTheme" >
</activity> 

The relevant styles:

<style name="mySettingsTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/mySettingsActionBar</item>
</style>

<style name="mySettingsActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:titleTextStyle">@style/mySettingsActionBarTitleTextStyle</item>
</style>

<style name="mySettingsActionBarTitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#FFFFFF</item>
</style>

I'm settings the flags to FullScreen using this code

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

During onCreate on PreferenceActivity class to remove the statusbar, but it doesn't work on the fragment. I've also tried creating a manifest field for that fragment, but nothing helped.

Can anyone help?

Aucun commentaire:

Enregistrer un commentaire