开发者

Applying a custom title bar for the entire application

I actually want to apply a custom title bar (kind of like the Action Bar), but since i'm developing for Froyo, I actually need to have it in a xml file. The trivial way to do this is to just write the code to create the title bar in each of the activities.

I did search around for some efficient ways and found this on SO

Similar Problem

There are 2 solutions proposed over there, but I am having problems in implementing them.

  1. To include the layout of your title bar in the layout of all the Activities. My question is say I have a sample layout as follows, where should the include tag go and do I need to use Theme.NoTitleBar theme for the application in order to get it working?

  2. To subclass Activity and then derive all of my Activities from that. Should the custom Title bar creation method be de开发者_运维知识库fined in the onCreate method of the subclassed Activity. Because if I do this, the custom title bar does appear, but it appears blank. No buttons,etc.. are present on it.

Thanks in advance for any help you provide


  1. The tag belongs inside the top level view container (linear layout/relative layout). Yes use NoTitleBar so you don't have the Android provided title bar in your app window.

  2. There is obviously an issue with your code there, with out any code in your post I cannot help you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜