Getting More Elbow Room

While the T-Mobile G1’s 320×480 screen is a luxury to those who developed apps for less-spacious screens, it always seems like you could use just a bit more room. Here are two tricks for clearing off some Android-supplied UI elements, so your activities can take up more space.

First up is the activity title bar. Much like the title bar in any Windows, OS X, or (most window managers in) Linux, it shows you the name of the application you are using. Sometimes, though, that is sufficiently obvious that you would rather reclaim the space from the bar. To do that, call requestWindowFeature(Window.FEATURE_NO_TITLE); from your activity’s onCreate() callback, before you set your content view.

For example, here is a snippet from the source code to Android’s calculator app:

[sourcecode language=”java”]
public void onCreate(Bundle icicle) {

This is also useful as a trick to do a fancier title bar than the stock Android one — just remove theirs and supply your own, completely under your control.

To gain even more room, you can go “full screen”. This eliminates the status bar at the top of the phone display, where the signal strength, battery meter, and whatnot reside. Removing this is dangerous, in that your users might get irritated if they have no way to know how much battery life remains, for example. But, in select situations, it may be worthwhile.

To go “full screen”, use the following, before you set your content view:

[sourcecode language=”java”]
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

About author

AndroidGuys 4672 posts

Founded on November 5, 2007, we've enjoyed bringing you the latest in Android news and rumors. Updated daily, we strive to deliver reviews, opinions, and updates on all things related to Android.

  • Jeffrey S

    This works, but results in a quick “flash” of the title bar when launching the app, before those flags are called. To prevent this flash, define a new theme like this:


    Then apply it to the activity:

    This makes your app do the same thing, but without the unsightly title bar flash before it’s removed in Java. :)

  • Jeffrey S
  • Romain Guy

    As a rule of thumb, anything you do to modify the appearance of the window should preferably be done with a theme. For instance, if you set your own background in your window, define the background in the theme. This will make the launch appear smoother and faster.

  • Mark Murphy

    Help! My blog post is being invaded by Googlers!


    Seriously, thanks guys! I remembered there was a theme floating around somewhere that handled this, but blanked on it when writing the post.

    Thanks again!

  • Romain Guy

    I plan on writing a blog post about how to use theme to improve perceived launch performance. We use this “trick” in the Maps application for instance.

  • Professor

    Мог бы долго с вами спорить на эту тему :)

  • Mike


  • Dianne

    You actually don’t need to make your own theme, there are some standard variations on the basic themes for this kind of stuff. For example, if you are using the default Theme, you could use android:theme=”@android:style/Theme.NoTitleBar” to not have a title bar. Likewise there is Theme.NoTitleBar.Fullscreen for no title bar and no status bar.