简体   繁体   English

活动ANDROID中的自定义TitleBar

[英]Custom TitleBar in activity ANDROID

I have a problem. 我有个问题。 I would like custom my TitleBar and when I try with this method: 我想自定义我的TitleBar,并尝试使用此方法:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle); getWindow()。setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.mytitle);

But he crash when i am in the Intent of my TabBar. 但是当我进入TabBar的意图时,他崩溃了。

He works in my main Activity, I think there are a different method for the intent of tabBar for customize the titleBar. 他在我的主要Activity中工作,我认为tabBar的意图可以使用不同的方法来自定义titleBar。

Someone known how it's done? 有人知道怎么做吗?

I'am a begginer developper Android. 我是Android的入门开发人员。

Thanks ! 谢谢 !

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);     

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

put your setContentLayout(); 把你的setContentLayout(); in the middle of these two. 在这两个中间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM