开发者

Android custom titlebar on launch activity showing wrong title

So I am setting a custom title bar f开发者_JS百科or 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜