2

So I am setting a custom title bar for all of my activities using the following code in the onCreate.

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    setContentView(id);

    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);        

    activityTitle = (TextView)findViewById(R.id.titleText);

    if (activityTitle != null)
    {
        activityTitle.setText(title);
    }

This sets the custom title bar correctly but I find that on the main launcher activity the name of the app shows in the title bar for a split second then changes to the title I set above. This only happens for the main entry point activity, all other activities show my custom title instantly. Any ideas why this would happen and how to fix?

Thanks

Bobbake4
  • 24,509
  • 9
  • 59
  • 94
  • Have you changed your title in the manifest? That is where most title information is stored. – Ashterothi Jul 14 '11 at 21:22
  • If I do that it shows the correct text but not the correct style. For instance my title bar the font is bigger and centered. This will be small font and aligned left for just a second before it gets replaced with my layout for the title bar. – Bobbake4 Jul 14 '11 at 21:30

1 Answers1

1

If you're saying that the default bar shows for a brief period of time before being replaced by your custom bar, you may be experiencing the same issue as here: Android: Custom Title Bar

The workaround there is to create a style that effectively hides the default title until your custom title is displayed. You may still get pop-in, but at least it won't be showing the wrong text.

Community
  • 1
  • 1
ImR
  • 787
  • 6
  • 8