Is it possible to use ActionBar without activity? I want to use it in the StatusBar view, instead of view highlighted with purple color.
4 Answers
This screen shot, based on an image from the Android ui pages, labels the different components, just to make sure we're talking about the same thing.
You can't add an ActionBar outside of an Activity. You need an Activity to get an ActionBar reference. ActionBar references are retrieved via the Activity API, by calling the getActionBar() method inside the Activity.
So you can't use an ActionBar to replace the StatusBar. You can change the StatusBar's color, and possibly layout, but only on a rooted phone. See this forum discussion for some perspective on the issue.
AFAIK, there is no API for changing the Notification Drawer's layout and functionality. There are no API methods that allows us to place an ActionBar inside the drawer outside of the notifications e.g. at the top of the drawer like in your screenshot.
You can create custom layouts for notifications(the messages inside the drawer). The Android Developer pages have an example on how to do it (see "Creating a Custom Notification Layout" at the bottom of the page). Again, you can't use an ActionBar but you can add Views to a Notification layout.

- 28,350
- 10
- 68
- 71
Use notifications. You will see something in the status bar and no Activity will be involved.

- 4,457
- 2
- 20
- 59
-
I'm sorry, which notifications you mean? – artem May 20 '12 at 21:14
There's GOT to be a way to change the ActionBar from a class declared within an Activity:
(1) create method in activity to .setTitle
(2) pass activity context to Controller class (MVC) declared in Activity
(3) have Controller class call activity method to modify actionBar
...what do you think?

- 1,335
- 1
- 10
- 27
-
...or perhaps by message passing between the Controller class and the activity...? – Quasaur Jan 07 '13 at 09:37
You should make a custom rom to change that view.
That Purple View is not part of your application but a part of Android.
If you do not want an Activity, why not make it transparent.
How do I create a transparent Activity on Android?

- 1
- 1

- 711
- 9
- 22
-
I work in company, that creates Android-based OS, and my task is to modify the OS, so, I know it ;) – artem May 22 '12 at 08:30