0

As far as I know, it is possible to hide the notification/title bar, once the activity is visible (has content) , But... maybe I'm wrong?

Is there any way to hide it after the activity is visible?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
dor506
  • 5,246
  • 9
  • 44
  • 79

1 Answers1

0

You can define the activity to use a theme that eliminates the notification/title bar. For instance, you can add this as an attribute to your <activity ... > tag in AndroidManifest.xml:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

The presence of a title cannot be changed once you have called setContentView(). The only way to hide the title bar after your activity has started is to restart the activity with a modified intent. Do something like this:

Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.putExtra("NoTitle", true);
finish();

overridePendingTransition(0, 0);
startActivity(intent);

Then in onCreate() test whether the "NoTitle" extra is present in the intent and make the appropriate call to requestWindowFeature() before calling setContentView().

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • I know, this isn't what I want. I don't want to hide it at all, but in some point during the activity running. – dor506 Jan 09 '12 at 17:00