3

I am developing a small application. I want to add my own Status bar at the top of my application with black background containing the battery, 3g,network and an icon of my choice. Please guyz help me out in creating a custom status bar..Thanks in advance

Prachi
  • 994
  • 5
  • 23
  • 36

2 Answers2

2

yes that is quite possible...

1- Make your application full screen.

2- Create a linear layout (as you wish)

3- if app contains more than one activity, include the layout in every layout...

For app full screen:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                            WindowManager.LayoutParams.FLAG_FULLSCREEN);

Status bar design depends on you...

Farhan
  • 13,290
  • 2
  • 33
  • 59
  • Acctually I hav already created a custom title bar for my application. But how can i place the battery meter, signal meter and notification in it? – Prachi Apr 29 '11 at 08:57
  • 1
    as i said, design it totally upto u... still, you can make your images/icons and place them in drawable folder, then in a linearlayout, set orientation = horizontal and place image views in it... set image view src to these icons... and for changing the battery icon, place different icons in drawable and set them manually through code... this is what i think... :) – Farhan Apr 29 '11 at 09:02
  • Ya, that i got. But how to change the change the battery icon. Can u please give me some code examples for that.I am very new to android. – Prachi Apr 29 '11 at 09:21
  • ImageView bateryIcon = (ImageView)findViewbyId(R.id.bateryIcon); //code to check the battery and find the appropriate icon... Now bateryIcon.setImageResource(other bateryIcon); something like this... – Farhan Apr 29 '11 at 09:33
  • That's not the solution! Because when the user swipes down the original Android Status bar will pop over! You are just telling him how to make an app fullscreen with a "toolbar" on top – stefan May 17 '17 at 12:43
1

If by "top status bar" you mean where the battery meter and signal meter and notifications go, you cannot change it from an app. You can set a theme to remove it (e.g., Theme.NoTitleBar.Fullscreen).

I believe you can use a custom view for the app's title bar. See the answers to this question:

Custom title with image

Community
  • 1
  • 1
Uday
  • 5,933
  • 9
  • 44
  • 76
  • I am already using a custom title bar for my app. I can add another custom title bar to my project but then how to get the battery meter, signal meter and notifications in it? – Prachi Apr 29 '11 at 08:54