简体   繁体   English

结合动作栏和自定义TitleBar?

[英]android - combine ActionBar and a custom TitleBar?

I'm creating an application for android 4.0 and above. 我正在为android 4.0及更高版本创建一个应用程序。 I use the Holo.Light theme with dark ActionBar ( Tabs as navigation mode). 我将Holo.Light主题与深色的ActionBarTabs作为导航模式)一起使用。

The problem: there are too many icons (tabs) I'd need to place into the ActionBar, so I'm thinking about creating a custom TitleBar and placing some Buttons there to keep the functionality whilst not overspamming the ActionBar . 问题:我需要在ActionBar中放置太多图标(标签),因此我正在考虑创建自定义TitleBar并在其中放置一些Buttons以保持功能,同时又不会使ActionBar过多。 I tried the following: 我尝试了以下方法:

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

This causes the app to crash with following message: 这会导致应用程序崩溃并显示以下消息:

08:00:24.063: E/AndroidRuntime(11283): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.maver1ck.test/net.maver1ck.test.Main}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

What are "other title features"? 什么是“其他标题功能”? Is that possible to use the ActionBar and a custom title? 是否可以使用ActionBar和自定义标题?

This is not so good idea to combine such bars. 组合这样的酒吧不是一个好主意。 Insted of it use custom layout only. 插入的仅使用自定义布局。

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

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