0

I'm creating an application for android 4.0 and above. I use the Holo.Light theme with dark ActionBar (Tabs as navigation mode).

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. 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?

Droidman
  • 11,485
  • 17
  • 93
  • 141
  • The Activity class forces calling setContentView() must be placed after calling requestWindowFeature() in onCreate(). Crashes may be due to this reason. Did you checked it? – Naetmul Aug 05 '13 at 05:54
  • sure. I edited the question for better understanding – Droidman Aug 05 '13 at 06:05

1 Answers1

1

This is not so good idea to combine such bars. Insted of it use custom layout only.

Sergey Brazhnik
  • 661
  • 4
  • 13
  • can you explain why that is not a good idea? In terms of usability that would be comfortable for the user to have some quick access in the titlebar.. – Droidman Aug 05 '13 at 06:11
  • IMHO, if I was going to customise the top navigation bar and would write my own ot avoid "hard to find bugs". Hope this'll help http://stackoverflow.com/questions/13805361/setting-a-window-feature-custom-title-creates-androidruntimeexception/13806493#13806493 – Sergey Brazhnik Aug 05 '13 at 06:33
  • well referring to this question it looks like that is not possible to use the ActionBar and a custom titleBar? But you can use the default (pretty ugly) Activity's titleBar.. Had to manually remove it. – Droidman Aug 05 '13 at 07:05
  • I'm working on outsource project right now. And the realization of the title bar totally custom. They have removed standart title bar and develop custom as custom view. It's very useful IMHO. – Sergey Brazhnik Aug 05 '13 at 07:17
  • ah, slowly I'm getting what you mean. But you can't actually position your View above the ActionBar, or..? – Droidman Aug 05 '13 at 07:24
  • No, you can't position you custom action bar above standart. You should remove standartr action bar – Sergey Brazhnik Aug 05 '13 at 07:40