tags:

views:

335

answers:

1

In Android documentation describing "Configuring General Window Properties", it is suggested that specifying properties via XML is preferable whenever possible to avoid seeing the title bar flash. As an example, instead of setting Window.FEATURE_NO_TITLE with requestWindowFeature, they set it to @android:style/Theme.NoTitleBar. Is there a similar way to set a custom title bar to be used in the XML?

+1  A: 

The complete set of XML attributes available is documented in R.styleable. There does not appear to be any Window attribute for custom title, so FEATURE_CUSTOM_TITLE can only be set in code.

According to this article, the best way to draw a title bar is to ignore FEATURE_CUSTOM_TITLE and instead just draw the title bar as part of your main view. This would not only avoid the flashing, but also problems caused by padding.

Casebash