0

I am working on application were most of activity are in full screen. so i implemented it with using theme.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

now i stuck with the situation were in one activity i need to show status bar. any buddy know how to forcefully made changes as it first apply the theme so how can i code to forcefully show only status bar not actionbar.

thanks

Luthando Ntsekwa
  • 3,914
  • 5
  • 19
  • 49
Nawaf
  • 404
  • 4
  • 16

1 Answers1

2

in the activity where you want the status bar, you can try this code:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

then if you have your title defined just make it visible, for example

((View) findViewById(android.R.id.title)).setVisibility(View.VISIBLE);
Android Team
  • 11,274
  • 2
  • 26
  • 46
  • thanks for your reply it works but status bar is overlaying my activity its default look (black color )is changed with activities gray color.is there any way to change it to default color. we had method setstatusbarcolor() color available in api level 21 is there any other way to support older api – Nawaf Sep 21 '15 at 11:46
  • to change status bar color for below api 21 is not supported, check here http://stackoverflow.com/questions/26496411/android-material-status-bar-color-wont-change/26623245#26623245, and can you up vote my answer if it helped you – Android Team Sep 21 '15 at 12:39
  • thanks for your reply do you have any idea to close the activity with transition effect – Nawaf Sep 21 '15 at 12:52