简体   繁体   English

如何在android中以编程方式添加标题栏背景图像

[英]How to add title bar background image programatically in android

I am new in android , How can add title bar background image programattically without change parent theme . 我是android的新手,如何在不改变父主题的情况下以编程方式添加标题栏背景图像。 My application is based on tab host . 我的应用程序基于标签主机。 There are two tabs. 有两个选项卡。 I want to remove appname and app icon from title bar and want to add background image. 我想从标题栏中删除appname和app图标,并想要添加背景图片。 Please help. 请帮忙。 Thanks in advance. 提前致谢。

You can infalte your custom layout to your title bar like this: 您可以将自定义布局渗透到标题栏,如下所示:

 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

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

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

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